@Override public long firstLongKey() { if (data.isEmpty()) { throw new NoSuchElementException(); } else { return extractor.getKey(data.get(0)); } }
@Override public long lastLongKey() { if (data.isEmpty()) { throw new NoSuchElementException(); } else { return extractor.getKey(data.get(data.size() - 1)); } }
@Override @SuppressWarnings("unchecked") public boolean containsValue(Object v) { if (v == null) { return false; } long key; try { key = extractor.getKey((T) v); } catch (ClassCastException ex) { return false; } int idx = findIndex(key); return idx >= 0 && data.get(idx).equals(v); }
public KeyedObjectMapBuilder<T> add(T item) { long key = extractor.getKey(item); int pos = posMap.get(key); if (pos < 0) { pos = builder.size(); posMap.put(key, pos); builder.add(item); } else { builder.set(pos, item); } return this; }
@Override public long firstLongKey() { if (data.isEmpty()) { throw new NoSuchElementException(); } else { return extractor.getKey(data.get(0)); } }
@Override public long lastLongKey() { if (data.isEmpty()) { throw new NoSuchElementException(); } else { return extractor.getKey(data.get(data.size() - 1)); } }
@Override @SuppressWarnings("unchecked") public boolean containsValue(Object v) { if (v == null) { return false; } long key; try { key = extractor.getKey((T) v); } catch (ClassCastException ex) { return false; } int idx = findIndex(key); return idx >= 0 && data.get(idx).equals(v); }
public KeyedObjectMapBuilder<T> add(T item) { long key = extractor.getKey(item); int pos = posMap.get(key); if (pos < 0) { pos = builder.size(); posMap.put(key, pos); builder.add(item); } else { builder.set(pos, item); } return this; }