For IntelliJ IDEA,
Android Studio or Eclipse



@Override public void bulkAdd(int[] keys) { for (int key : keys) { delegate.add(key); } }
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); set = new CircuitBreakerIntHashSet(size); for (long i = 0; i < size; i++) { set.add(in.readVInt()); } }
public static void main(String[] args) { final long start = System.currentTimeMillis(); final IntHashSet a = new com.carrotsearch.hppc.IntHashSet(); for( int i = 10000000; i-- != 0; ) a.add(i); IntHashSet b = new com.carrotsearch.hppc.IntHashSet(a.size()); b.addAll(a); b = new com.carrotsearch.hppc.IntHashSet(); b.addAll(a); final long time = System.currentTimeMillis() - start; System.out.println( time / 1000.0 ); System.out.println( b.size() ); } }
private void relax(int nodeId) { IntHashSet connected = new IntHashSet(); int w; do { w = stack.pop(); onStack.clear(w); connected.add(w); } while (w != nodeId); connectedComponents.add(connected); int size = connected.size(); if (size < minSetSize) { minSetSize = size; } if (size > maxSetSize) { maxSetSize = size; } }
/** * This method makes edges crossing the specified border inaccessible to split a bigger area into smaller subnetworks. * This is important for the world wide use case to limit the maximum distance and also to detect unreasonable routes faster. */ protected IntHashSet findBorderEdgeIds(SpatialRuleLookup ruleLookup) { AllEdgesIterator allEdgesIterator = graph.getAllEdges(); NodeAccess nodeAccess = graph.getNodeAccess(); IntHashSet inaccessible = new IntHashSet(); while (allEdgesIterator.next()) { int adjNode = allEdgesIterator.getAdjNode(); SpatialRule ruleAdj = ruleLookup.lookupRule(nodeAccess.getLatitude(adjNode), nodeAccess.getLongitude(adjNode)); int baseNode = allEdgesIterator.getBaseNode(); SpatialRule ruleBase = ruleLookup.lookupRule(nodeAccess.getLatitude(baseNode), nodeAccess.getLongitude(baseNode)); if (ruleAdj != ruleBase) { inaccessible.add(allEdgesIterator.getEdge()); } } return inaccessible; }
private void relax(int nodeId) { IntHashSet connected = new IntHashSet(); int w; do { w = stack.pop(); onStack.clear(w); connected.add(w); } while (w != nodeId); processSCC(nodeId, connected); }
private void readFromBytes(BytesRef bytesRef) { // Read pruned flag this.setIsPruned(bytesRef.bytes[bytesRef.offset++] == 1 ? true : false); // Read size fo the set int size = Bytes.readInt(bytesRef); // Read terms // Scatter set is slightly more efficient than the hash set, but should be used only for lookups, // not for merging set = new IntScatterSet(size); for (int i = 0; i < size; i++) { set.add(Bytes.readVInt(bytesRef)); } }
outgoing.add(tp.getTo()); flattenVector = tp.getTo(); transferFieldIds.add(vectorRead.getFieldId().getFieldIds()[0]);
/** * 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(int... elements) { ensureCapacity(elements.length); int count = 0; for (int e : elements) { if (add(e)) { count++; } } return count; }
@Override public void add(int key) { delegate.add(key); }
@Override public void add(long term) { this.set.add((int) 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 IntCursor> iterable) { int count = 0; for (IntCursor cursor : iterable) { if (add(cursor.value)) { count++; } } return count; }
/** * 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 IntCursor> iterable) { int count = 0; for (IntCursor 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(int... elements) { ensureCapacity(elements.length); int count = 0; for (int e : elements) { if (add(e)) { count++; } } return count; }
/** * This method makes edges crossing the specified border inaccessible to split a bigger area into smaller subnetworks. * This is important for the world wide use case to limit the maximum distance and also to detect unreasonable routes faster. */ protected IntHashSet findBorderEdgeIds(SpatialRuleLookup ruleLookup) { AllEdgesIterator allEdgesIterator = graph.getAllEdges(); NodeAccess nodeAccess = graph.getNodeAccess(); IntHashSet inaccessible = new IntHashSet(); while (allEdgesIterator.next()) { int adjNode = allEdgesIterator.getAdjNode(); SpatialRule ruleAdj = ruleLookup.lookupRule(nodeAccess.getLatitude(adjNode), nodeAccess.getLongitude(adjNode)); int baseNode = allEdgesIterator.getBaseNode(); SpatialRule ruleBase = ruleLookup.lookupRule(nodeAccess.getLatitude(baseNode), nodeAccess.getLongitude(baseNode)); if (ruleAdj != ruleBase) { inaccessible.add(allEdgesIterator.getEdge()); } } return inaccessible; }