@Override public int firstInt() { synchronized (sync) { return sortedSet.firstInt(); } } @Override
@Override public int firstInt() { return sortedSet.firstInt(); } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default Integer first() { return Integer.valueOf(firstInt()); } /**
@Override public int enableInstance( final R2TransformOrthogonalReadableType t) { NullCheck.notNull(t); if (this.enabledCount() == this.max_size) { final StringBuilder sb = new StringBuilder(64); sb.append("Batch is full (capacity is "); sb.append(this.max_size); sb.append(")"); throw new R2ExceptionBatchIsFull(sb.toString()); } Preconditions.checkPrecondition( !this.free.isEmpty(), "Free set must not be empty"); final int next = this.free.firstInt(); this.members[next] = t; this.free.remove(next); return next; }
public Integer add(K k) { checkK(k); Integer id = timeSortedMap.get(k); if (id == null) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstInt(); garbageQueue.remove(id); } else { id = length++; } timeSortedMap.put(k, id); ensureArraySize(id); countMap[id] = 1; } else { countMap[id]++; } return id; }
public Integer add(K k) { checkK(k); Integer id = timeSortedMap.get(k); if (id == null) { if (!garbageQueue.isEmpty()) { id = garbageQueue.firstInt(); garbageQueue.remove(id); } else { id = length++; } timeSortedMap.put(k, id); ensureArraySize(id); countMap[id] = 1; } else { countMap[id]++; } return id; }
protected int addLeaf(final Octant octant) { int id; if (!garbageQueue.isEmpty()) { id = garbageQueue.firstInt(); garbageQueue.remove(id); } else { id = length++; ensureArraySize(id); } leaves[id] = octant; leavesCount++; octant.leafId = id; return id; }
protected int addView(final GraphViewImpl view) { checkNonNullViewObject(view); int id; if (!garbageQueue.isEmpty()) { id = garbageQueue.firstInt(); garbageQueue.remove(id); } else { id = length++; ensureArraySize(id); } views[id] = view; view.storeId = id; return id; }
protected int addView(final GraphViewImpl view) { checkNonNullViewObject(view); int id; if (!garbageQueue.isEmpty()) { id = garbageQueue.firstInt(); garbageQueue.remove(id); } else { id = length++; ensureArraySize(id); } views[id] = view; view.storeId = id; return id; }
/** * Returns the minimal range that * {@linkplain IntRange#contains(int) contains} all of the given values. * The returned range is {@linkplain BoundType#CLOSED closed} on both ends. * * @throws ClassCastException if the parameters are not <i>mutually * comparable</i> * @throws NoSuchElementException if {@code values} is empty * @throws NullPointerException if any of {@code values} is null * @since 14.0 */ public static IntRange encloseAll(IntCollection values) { checkNotNull(values); if (values instanceof IntSortedSet) { IntSortedSet setValues = (IntSortedSet) values; return closed(setValues.firstInt(), setValues.lastInt()); } IntIterator valueIterator = values.iterator(); int min = checkNotNull(valueIterator.next()); int max = min; while (valueIterator.hasNext()) { int value = checkNotNull(valueIterator.next()); min = Integer.min(min, value); max = Integer.max(max, value); } return closed(min, max); }