Example usage for com.google.common.base Optional absent

List of usage examples for com.google.common.base Optional absent

Introduction

In this page you can find the example usage for com.google.common.base Optional absent.

Prototype

public static <T> Optional<T> absent() 

Source Link

Document

Returns an Optional instance with no contained reference.

Usage

From source file:se.sics.ktoolbox.util.Either.java

public Optional<R> getOptionalRight() {
    if (this.isRight()) {
        return Optional.fromNullable(this.getRight());
    } else {// w  ww .  j a  va  2s .c  o  m
        return Optional.absent();
    }
}

From source file:com.facebook.buck.cxx.DefaultPreprocessor.java

@Override
public Optional<ImmutableList<String>> getExtraFlags() {
    return Optional.absent();
}

From source file:cc.ilo.cc.ilo.pipeline.producer.InjectionProducer.java

@Override
public Optional<T> getNext() throws InterruptedException {
    Optional<T> out;/*from   w ww .  j av  a  2  s. c  o  m*/
    if ((out = outQueue.peek()) == null) {
        if (stopped) {
            return Optional.absent();
        }
        LOGGER.trace("input too slow - blocking");
        out = outQueue.take();
        return out;
    }
    return outQueue.poll();
}

From source file:org.feature4j.MatcherFeatureOverride.java

@Override
public Optional<V> extractFeatureValue(FeaturesContext ctx) {
    if (matcher.matches(ctx)) {
        return Optional.of(overrideValue);
    } else {//  w  ww.j a v a 2 s. c o m
        return Optional.absent();
    }
}

From source file:org.eclipse.mylyn.internal.wikitext.commonmark.inlines.PotentialBracketSpan.java

@Override
public Optional<? extends Inline> createInline(Cursor cursor) {
    char c = cursor.getChar();
    if (c == '!' && cursor.hasNext() && cursor.getNext() == '[') {
        return Optional.of(new PotentialBracketDelimiter(cursor.getLineAtOffset(), cursor.getOffset(), 2,
                cursor.getTextAtOffset(2)));
    }/*  w  ww . j av  a2 s  .  c om*/
    if (c == '[') {
        return Optional.of(new PotentialBracketDelimiter(cursor.getLineAtOffset(), cursor.getOffset(), 1,
                cursor.getTextAtOffset(1)));
    }
    if (c == ']') {
        return Optional.of(new PotentialBracketEndDelimiter(cursor.getLineAtOffset(), cursor.getOffset()));
    }
    return Optional.absent();
}

From source file:org.locationtech.geogig.storage.sqlite.SQLiteConflictsDatabase.java

@Override
public Optional<Conflict> getConflict(String namespace, String path) {
    List<Conflict> conflicts = getConflicts(namespace, path);
    if (conflicts.isEmpty()) {
        return Optional.absent();
    }/*from ww  w .  j  a va  2  s  . c  o  m*/
    return Optional.of(conflicts.get(0));
}

From source file:org.asoem.greyfish.utils.collect.UnrolledListAT.java

private static <T> Optional<T> findFirstIterative(final List<T> list, final Predicate<? super T> predicate) {
    for (T t : list) {
        if (predicate.apply(t)) {
            return Optional.of(t);
        }//from w w  w . j  a  v  a2 s .c  o m
    }
    return Optional.absent();
}

From source file:uk.gov.hmrc.service.HelloWorldService.java

public String helloWorld() {
    try {/*from  ww w.  ja v  a  2  s  .com*/
        return serviceConnector.get("https://api.service.hmrc.gov.uk/hello/world",
                "application/vnd.hmrc.1.0+json", Optional.absent());
    } catch (UnauthorizedException e) {
        throw new RuntimeException(e);
    }
}

From source file:de.flapdoodle.apache.pivot.events.AsyncEvent.java

public <X> Optional<X> payload(Class<X> type) {
    if (!failed()) {
        if (type.isInstance(payload)) {
            return Optional.of((X) payload);
        }/*from  www  .  j av a 2  s  .  c  o  m*/
    }
    return Optional.absent();
}

From source file:com.google.template.soy.passes.htmlmatcher.HtmlMatcherAccumulatorNode.java

@Override
public Optional<SoyNode> getSoyNode() {
    return Optional.absent();
}