Example usage for org.apache.commons.lang3.tuple Pair of

List of usage examples for org.apache.commons.lang3.tuple Pair of

Introduction

In this page you can find the example usage for org.apache.commons.lang3.tuple Pair of.

Prototype

public static <L, R> Pair<L, R> of(final L left, final R right) 

Source Link

Document

Obtains an immutable pair of from two objects inferring the generic types.

This factory allows the pair to be created using inference to obtain the generic types.

Usage

From source file:controllers.api.ApiAuthenticationBizdockCheck.java

@Override
public Pair<Boolean, String> after() {
    return Pair.of(true, null);
}

From source file:ivorius.ivtoolkit.tools.Pairs.java

public static <L, R> Iterable<Pair<L, R>> pairRight(Iterable<L> left, final R right) {
    return Iterables.transform(left, new Function<L, Pair<L, R>>() {
        @Nullable/*from  www .  ja  v a 2  s  .co m*/
        @Override
        public Pair<L, R> apply(L input) {
            return Pair.of(input, right);
        }
    });
}

From source file:com.streamsets.pipeline.lib.fuzzy.FuzzyMatch.java

public static int getRatio(String s1, String s2, boolean useCache) {
    if (useCache) {
        return ratioCache.getUnchecked(Pair.of(s1, s2));
    } else {//from w ww.j  a v a  2 s.c o m
        return getRatio(s1, s2);
    }
}

From source file:alfio.controller.support.TemplateProcessorTest.java

@Test
public void testCoverityFindingDivisionByZero() {
    assertDimensionsUnder300x150(Pair.of("0", "1500"));
    assertDimensionsUnder300x150(Pair.of("1500", "0"));
}

From source file:com.yahoo.bullet.result.ClipTest.java

@Test
public void testRecordAddition() {
    BulletRecord record = new RecordBox().add("field", "sample").addMap("map_field", Pair.of("foo", "bar"))
            .addList("list_field", new HashMap<>(), singletonMap("foo", 1L)).getRecord();
    assertJSONEquals(Clip.of(record).asJSON(),
            makeJSON("[{'list_field':[{},{'foo':1}],'field':'sample','map_field':{'foo':'bar'}}]"));
}

From source file:com.github.blindpirate.gogradle.util.MapUtils.java

public static <K, V> Map<K, V> asMapWithoutNull(K k, V v) {
    return asMapWithoutNull(Pair.of(k, v));
}

From source file:net.minecraftforge.client.MinecraftForgeClient.java

public static RegionRenderCache getRegionRenderCache(World world, BlockPos pos) {
    int x = pos.getX() & ~0xF;
    int y = pos.getY() & ~0xF;
    int z = pos.getZ() & ~0xF;
    return regionCache.getUnchecked(Pair.of(world, new BlockPos(x, y, z)));
}

From source file:cc.recommenders.evaluation.evaluators.SizeAndF1Evaluator.java

@Override
public Pair<Boxplot, Integer> getResults() {
    Boxplot f1 = f1Evaluator.getResults();
    int avgModelSize = sizeAverager.getResults();
    return Pair.of(f1, avgModelSize);
}

From source file:com.lithium.flow.filer.CachedReadFiler.java

public CachedReadFiler(@Nonnull Filer delegate) {
    super(checkNotNull(delegate));
    cache = Caches.build(path -> {//from  w  w  w  .j a va2s.c  o m
        try (InputStream in = delegate.readFile(path)) {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            IOUtils.copy(in, out);
            return Pair.of(delegate.getRecord(path).getTime(), out.toByteArray());
        }
    }, CacheBuilder::softValues);
}

From source file:cc.kave.commons.model.groum.GroumBuilder.java

public GroumBuilder withEdge(Node source, Node target) {
    edges.add(Pair.of(source, target));
    return this;
}