Gets the first element of the set.
@return   first element of the set, -1 if the set is empty
512762
public int first() {
        int val;
        int i;

        for (i = 0; i < data.length; i++) {
            if (data[i] != 0) {
                val = data[i];
                i <<= SHIFT;
                while ((val & 1) == 0) {
                    val >>>= 1;
                    i++;
                }
                return i;
            }
        }
        return -1;
    }
201288
public String getFirst(String key)
    {
        if(key == null)
            throw new IllegalArgumentException("Null keys not allowed.");

        List<String> vals = map.get(key);
        if(vals == null || vals.size() == 0)
            return null;

        return vals.get(0);
    }
1282420
public static <T> T getFirst(T[] objectArray)
    {
        if (ArrayIterate.notEmpty(objectArray))
        {
            return objectArray[0];
        }
        return null;
    }
413721
public function getFirst()
    {
        $varReturn = null;
        if (count($this->collection) > 0) {
            $varReturn = $this->collection[0];
        }

        return $varReturn;
    }
101454
public Optional<T> first() {
    Iterator<T> itr = iterator();
    return itr.hasNext() ? Optional.of(itr.next()) : Optional.<T>absent();
  }
680916
def first(self):
        
        self.params['limit'] = 1
        result = self.all()
        return result.items[0] if result.total > 0 else None
76876
public static <T> T getFirst(T array[]){
        return array!=null && array.length>0 ? array[0] : null;
    }
13712
public int[][] getSets() {
        int n = 0;
        for (int i = 0; i < forest.length; i++) {
            if (forest[i] < 0) {
                n++;
            }
        }
        int[][] sets = new int[n][];
        int currentSet = 0;
        for (int i = 0; i < forest.length; i++) {
            if (forest[i] < 0) {
                int setSize = 1 - forest[i] - 1;
                sets[currentSet] = new int[setSize];
                int currentIndex = 0;
                for (int element = 0; element < forest.length; element++) {
                    if (getRoot(element) == i) {
                        sets[currentSet][currentIndex] = element;
                        currentIndex++;
                    }
                }
                currentSet++;
            }
        }
        return sets;
    }
170811
public String getFirstValue() {
        CharSequence firstValue;

        synchronized (values) {
            if (values.isEmpty()) {
                return null;
            }
            firstValue = values.get(0);
        }

        return firstValue.toString();
    }
1249057
@SuppressWarnings("unchecked")
    public Object getFirstKeyPart() {
        Object keyPart = null;
        if (this.key.value() instanceof List && !((List<Object>) this.key.value()).isEmpty()) {
            keyPart = ((List<Object>) this.key.value()).get(0);
        } else {
            // UniqueKey or MultitontKey with only one key part
            keyPart = this.key.value();
        }
        return keyPart;
    }
189487
public function first()
    {
        $sql = clone($this);
        $sql->limit(1);
        $collection = $this->query($sql);
        return $collection->isEmpty() ? null : $collection[0];
    }
488951
public static <T> Set<T> nullToEmpty(final Set<T> set) {
        return set == null ? N.<T> emptySet() : set;
    }
446900
public static <T> T getFirst(List<T> collection)
    {
        return Iterate.isEmpty(collection) ? null : collection.get(0);
    }
531569
public function first()
    {
        $this->limit(1);
        $result = $this->get();
        return empty($result) ? null : $result[0];
    }
369264
@Nullable
  public ResultT first() {
    final CoreRemoteMongoCursor<ResultT> cursor = iterator();
    if (!cursor.hasNext()) {
      return null;
    }
    return cursor.next();
  }
282611
public Set<B> getValues(A first) {
    if (counts.containsKey(first)) {
      return counts.get(first).keySet();
    }
    return Collections.emptySet();
  }
424925
public static Object getFirstElement(Object maybeIterable) {
    if (!(maybeIterable instanceof Iterable<?>)) return null;
    Iterable<?> iterable = (Iterable<?>) maybeIterable;
    Iterator<?> iterator = iterable.iterator();
    return iterator.hasNext() ? iterator.next() : null;
  }