Return the first optional to be defined.

@param a The first
@param b The second
@param <T> The type
@return a or b or empty
760753
@SuppressWarnings("unchecked")
    public static <T> Optional<T> or(final Optional<T> a, final Optional<? extends T> b) {
        return a.isPresent() ? a : (Optional<T>) b;
    }
1043093
public static <T> Predicate<T> and(Predicate<? super T> first, Predicate<? super T> second) {
		return new AndPredicate<>(Predicates.<T> asList(Objects.requireNonNull(first), Objects.requireNonNull(second)));
	}
643975
public static <T> Optional<T[]> getOptional(T[] array) {
        return Optional.ofNullable(array).filter(a -> a.length > 0);
    }
35736
public static <T> List<T> getNonIntersectionInListA(List<T> a, List<T> b) {
        List<T> nonIntersectionInListA = new ArrayList<>();
        for (T t : a) {
            if (!b.contains(t)) {
                nonIntersectionInListA.add(t);
            }
        }
        return nonIntersectionInListA;
    }
1196278
public static <T> Iterator<T> concat( final Iterator<T> a,
                                          final Iterator<T> b ) {
        assert (a != null);
        assert (b != null);

        return new Iterator<T>() {

            @Override
            public boolean hasNext() {
                return a.hasNext() || b.hasNext();
            }

            @Override
            public T next() {
                if (a.hasNext()) {
                    return a.next();
                }

                return b.next();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
787198
public int compare(final T first, final T second) {
    int cmpRs = 0;
    for (final Comparator<T> com : comparators) {
      cmpRs = com.compare(first, second);
      if (0 == cmpRs) {
        continue;
      } else {
        break;
      }
    }
    return cmpRs;
  }
101454
public Optional<T> first() {
    Iterator<T> itr = iterator();
    return itr.hasNext() ? Optional.of(itr.next()) : Optional.<T>absent();
  }
880980
public <R> Optional<R> map(Func1<T, R> func1) {
        return value == null ? Optional.<R>empty() : Optional.of(func1.call(value));
    }
1164000
@Override
    public $.Option<T> findFirst($.Function<? super T, Boolean> predicate) {
        return findOne(predicate);
    }
827577
@SuppressWarnings("unchecked")
    public static <T> Optional<Class<T>> optional(String dependency) {
        try {
            return Optional.of((Class<T>) Class.forName(dependency));
        } catch (ClassNotFoundException | NoClassDefFoundError e) {
            return Optional.empty();
        }
    }
693407
public static <T> Predicate<T> AND(final Predicate<T> a, final Predicate<T> b) {
	return new Predicate<T>() {
	    public boolean check(T obj) {
		return a.check(obj) && b.check(obj);
	    }
	};
    }
204728
public static <T> Choice<T> fromOptional(Optional<T> optional) {
    return optional.isPresent() ? of(optional.get()) : Choice.<T>none();
  }
369732
static <T> Optional<T> findFirst(final Class<T> service) {
        final ServiceLoader<T> loader = load(service);
        if (loader == null) return empty();
        final Iterator<T> services = loader.iterator();
        return services.hasNext() ? of(services.next()) : empty();
    }
281478
public static <T> Optional<T> narrowK(final Higher<optional, T> Optional) {
    //has to be an OptionalKind as only OptionalKind can implement Higher<optional, T>
    return ((OptionalKind<T>)Optional).boxed;

  }
1245939
static int compareWithNullHigh(Object a, Object b) {
        return a == null ? (b == null ? 0 : -1) : (b == null ? 1 : ((Comparable) a).compareTo(b));
    }
1098640
@SuppressWarnings("unchecked")
    public final T first(T defaultValue) {
        if (this instanceof Callable) {
            return checkedCall((Callable<T>) this);
        }
        Iterator<T> it = iterator();
        if (it.hasNext()) {
            return it.next();
        }
        return defaultValue;
    }
1076512
public static <T> boolean le(Comparable<T> a, T b)
	{
		return le(a.compareTo(b));
	}