Java Code Examples for com.googlecode.totallylazy.Option#none()
The following examples show how to use
com.googlecode.totallylazy.Option#none() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaticMemberCompleter.java From java-repl with Apache License 2.0 | 6 votes |
private Option<Pair<String, Sequence<String>>> parseExpression(Pair<String, Sequence<String>> expression) { Option<Class<?>> expressionClass = evaluator.classFrom(expression.first()); if (!expressionClass.isEmpty()) { return some(expression); } if (expression.first().contains(".")) { final String packagePart = expression.first().substring(0, expression.first().lastIndexOf(".")); final String classPart = expression.first().substring(expression.first().lastIndexOf(".") + 1); return parseExpression(pair(packagePart, expression.second().cons(classPart))); } return Option.none(); }
Example 2
Source File: Creator.java From yatspec with Apache License 2.0 | 5 votes |
public static Option<? extends Class<?>> optionalClass(String name) { try { return Option.some(Class.forName(name)); } catch (ClassNotFoundException e) { return Option.none(); } }
Example 3
Source File: PersistentList.java From totallylazy with Apache License 2.0 | 5 votes |
@tailrec default Option<T> lastOption() { if(isEmpty()) return Option.none(); PersistentList<T> tail = tail(); if(tail.isEmpty()) return headOption(); return tail.lastOption(); }
Example 4
Source File: covered_covered_t.java From coming with MIT License | 4 votes |
private Option<java.lang.reflect.Type> typeFor(Expression expression) { return (expression instanceof AssignmentWithType) ? Option.some(((AssignmentWithType) expression).type()) : Option.<java.lang.reflect.Type>none(); }
Example 5
Source File: covered_covered_s.java From coming with MIT License | 4 votes |
private Option<java.lang.reflect.Type> typeFor(Expression expression) { return (expression instanceof AssignmentWithType) ? Option.some(((AssignmentWithType) expression).type()) : Option.<java.lang.reflect.Type>none(); }
Example 6
Source File: TreeSet.java From totallylazy with Apache License 2.0 | 4 votes |
@Override public Option<T> headOption() { return isEmpty() ? Option.<T>none() : some(head()); }
Example 7
Source File: TreeList.java From totallylazy with Apache License 2.0 | 4 votes |
@Override public Option<T> headOption() { return isEmpty() ? Option.<T>none() : some(head()); }
Example 8
Source File: HashTreeMap.java From totallylazy with Apache License 2.0 | 4 votes |
@Override public Option<Pair<K, V>> headOption() { if(isEmpty()) return Option.none(); return Option.some(head()); }
Example 9
Source File: AbstractSegment.java From totallylazy with Apache License 2.0 | 4 votes |
@Override public Option<T> headOption() { return isEmpty() ? Option.<T>none() : some(head()); }
Example 10
Source File: Evaluator.java From java-repl with Apache License 2.0 | 4 votes |
private Option<java.lang.reflect.Type> typeFor(Expression expression) { return (expression instanceof AssignmentWithType) ? Option.some(((AssignmentWithType) expression).type()) : Option.<java.lang.reflect.Type>none(); }