List of usage examples for com.google.common.collect ImmutableSortedMap headMap
ImmutableSortedMap<K, V> headMap(K toKey, boolean inclusive)
From source file:edu.mit.streamjit.util.bytecode.methodhandles.Combinators.java
private static MethodHandle lookupswitch0(ImmutableSortedMap<Integer, MethodHandle> cases, MethodHandle defaultCase) { if (cases.isEmpty()) return defaultCase; if (cases.size() == 1) { Map.Entry<Integer, MethodHandle> next = cases.entrySet().iterator().next(); return MethodHandles.guardWithTest(eq(next.getKey()), MethodHandles.dropArguments(next.getValue(), 0, int.class), //discard the case index defaultCase);//from w w w . j av a 2 s.c o m } int median = median(cases.keySet().asList()); return MethodHandles.guardWithTest(le(median), lookupswitch0(cases.headMap(median, true), defaultCase), lookupswitch0(cases.tailMap(median, false), defaultCase)); }