/** * Create a new keyed object map. * @param objs A collection of objects to put in the map. * @param ex The key extractor. * @param <T> The keyed object type. * @return A keyed object map of the objects in {@code objs}. */ public static <T> KeyedObjectMap<T> create(Iterable<? extends T> objs, KeyExtractor<? super T> ex) { return new KeyedObjectMap<>(objs, ex); }
public KeyedObjectMap<T> build() { return new KeyedObjectMap<>(builder, extractor); } }
/** * Create a new keyed object map. * @param objs A collection of objects to put in the map. * @param <T> The keyed object type. * @return A keyed object map of the objects in {@code objs}. */ public static <T extends KeyedObject> KeyedObjectMap<T> create(Collection<? extends T> objs) { return new KeyedObjectMap<>(objs, Keys.selfExtractor()); }
/** * Create a new result map from a collection of results. * @param objs The results. */ public BasicResultMap(Iterable<? extends Result> objs) { this(new KeyedObjectMap<>(objs, Results.keyExtractor())); }
@Override public KeyedObjectMap<T> tailMap(long l) { int start = findIndex(l); start = BinarySearch.resultToIndex(start); return new KeyedObjectMap<>(data.subList(start, data.size()), extractor, true); }
@Override public KeyedObjectMap<T> headMap(long l) { int stop = findIndex(l); stop = BinarySearch.resultToIndex(stop); return new KeyedObjectMap<>(data.subList(0, stop), extractor, true); }
@Override public KeyedObjectMap<T> subMap(long from, long to) { int start = findIndex(from); int stop = findIndex(to); start = BinarySearch.resultToIndex(start); stop = BinarySearch.resultToIndex(stop); return new KeyedObjectMap<>(data.subList(start, stop), extractor, true); }
public KeyedObjectMap<T> build() { return new KeyedObjectMap<>(builder, extractor); } }
/** * Create a new keyed object map. * @param objs A collection of objects to put in the map. * @param ex The key extractor. * @param <T> The keyed object type. * @return A keyed object map of the objects in {@code objs}. */ public static <T> KeyedObjectMap<T> create(Iterable<? extends T> objs, KeyExtractor<? super T> ex) { return new KeyedObjectMap<>(objs, ex); }
/** * Create a new result map from a collection of results. * @param objs The results. */ public BasicResultMap(Iterable<? extends Result> objs) { this(new KeyedObjectMap<>(objs, Results.keyExtractor())); }
/** * Create a new keyed object map. * @param objs A collection of objects to put in the map. * @param <T> The keyed object type. * @return A keyed object map of the objects in {@code objs}. */ public static <T extends KeyedObject> KeyedObjectMap<T> create(Collection<? extends T> objs) { return new KeyedObjectMap<>(objs, Keys.selfExtractor()); }
@Override public KeyedObjectMap<T> tailMap(long l) { int start = findIndex(l); start = BinarySearch.resultToIndex(start); return new KeyedObjectMap<>(data.subList(start, data.size()), extractor, true); }
@Override public KeyedObjectMap<T> headMap(long l) { int stop = findIndex(l); stop = BinarySearch.resultToIndex(stop); return new KeyedObjectMap<>(data.subList(0, stop), extractor, true); }
@Override public KeyedObjectMap<T> subMap(long from, long to) { int start = findIndex(from); int stop = findIndex(to); start = BinarySearch.resultToIndex(start); stop = BinarySearch.resultToIndex(stop); return new KeyedObjectMap<>(data.subList(start, stop), extractor, true); }