/** * Adds all elements from the given iterable to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ public int addAll(Iterable<? extends LongCursor> iterable) { int count = 0; for (LongCursor cursor : iterable) { if (add(cursor.value)) { count++; } } return count; }
/** * Adds all elements from the given list (vararg) to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ /* */ public final int addAll(long... elements) { ensureCapacity(elements.length); int count = 0; for (long e : elements) { if (add(e)) { count++; } } return count; }
public LongSet(NullableDateMilliHolder[] holders) { for(NullableDateMilliHolder h : holders) { if(h.isSet == 0) { // one null is never equal to another null. continue; } longSet.add(h.value); } }
public LongSet(NullableTimeStampMilliHolder[] holders) { for(NullableTimeStampMilliHolder h : holders) { if(h.isSet == 0) { // one null is never equal to another null. continue; } longSet.add(h.value); } }
public LongSet(NullableBigIntHolder[] holders) { for(NullableBigIntHolder h : holders) { if(h.isSet == 0) { // one null is never equal to another null. continue; } longSet.add(h.value); } }
@Override public void add(long term) { this.set.add(term); }
/** * Adds all elements from the given iterable to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ public int addAll(Iterable<? extends LongCursor> iterable) { int count = 0; for (LongCursor cursor : iterable) { if (add(cursor.value)) { count++; } } return count; }
/** * Adds all elements from the given list (vararg) to this set. * * @return Returns the number of elements actually added as a result of this * call (not previously present in the set). */ /* */ public final int addAll(long... elements) { ensureCapacity(elements.length); int count = 0; for (long e : elements) { if (add(e)) { count++; } } return count; }
private void readFromBytes(BytesRef bytes) { // Read pruned flag this.setIsPruned(bytes.bytes[bytes.offset++] == 1 ? true : false); // Read size fo the set int size = Bytes.readInt(bytes); // Read terms // Scatter set is slightly more efficient than the hash set, but should be used only for lookups, // not for merging set = new LongScatterSet(size); for (int i = 0; i < size; i++) { set.add(Bytes.readLong(bytes)); } }
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); set = new CircuitBreakerLongHashSet(size); for (long i = 0; i < size; i++) { set.add(in.readLong()); } }