ItemStack stack = items.keySet().iterator().next(); int cost = items.get(stack); int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
/** * Get the nodes with defined capacities * * @return a set that may be empty */ public Set<Node> getDefinedNodes() { return nodesCapacity.keySet(); }
/** See {@link gnu.trove.map.hash.TObjectIntHashMap#keySet()} */ public Set<K> keySet() { return delegate.keySet(); }
/** * Get the VMs with defined consumptions. * * @return a set that may be empty */ public Set<VM> getDefinedVMs() { return vmsConsumption.keySet(); }
/** See {@link gnu.trove.map.hash.TObjectIntHashMap#keySet()} */ public Set<K> keySet() { return delegate.keySet(); }
/** * {@inheritDoc} */ public Set<T> items() { return Collections.unmodifiableSet(indices.keySet()); }
/** * {@inheritDoc} */ public Set<T> items() { return Collections.unmodifiableSet(indices.keySet()); }
public static Set<ComparableItemStack> getGemFuels() { return ImmutableSet.copyOf(gemFuelMap.keySet()); }
public static Set<ComparableItemStack> getFuels() { return ImmutableSet.copyOf(fuelMap.keySet()); }
public static Set<ComparableItemStack> getFuels() { return ImmutableSet.copyOf(fuelMap.keySet()); }
public static Set<ComparableItemStack> getFuels() { return ImmutableSet.copyOf(fuelMap.keySet()); }
public static Set<ComparableItemStack> getFuels() { return ImmutableSet.copyOf(fuelMap.keySet()); }
@SubscribeEvent public void tickEnd(TickEvent event) { if(event.type == Type.SERVER && event.phase == Phase.END) { for(DimWithPos s : coordsToCheck.keySet()) { decrCoords(s); if(checkedCoords.contains(s))
@Override public String toString() { StringJoiner joiner = new StringJoiner(",", String.format("rc:%s:", rcId), ""); for (Node n: nodesCapacity.keySet()) { int c = nodesCapacity.get(n); joiner.add(String.format("<node %s,%d>", n, c)); } StringJoiner vmJoiner = new StringJoiner(","); for (VM vm: vmsConsumption.keySet()) { int c = vmsConsumption.get(vm); vmJoiner.add(String.format("<VM %s,%d>", vm, c)); } return String.format("%s%s", joiner, vmJoiner); }
/** * Remove any key and its value that matches the predicate <i>filter</i> * @param filter predicate that satisfies (key,value) to remove */ public boolean removeIf(Predicate<? super E> filter) { Objects.requireNonNull(filter); boolean removed = false; final Iterator<E> each = map.keySet().iterator(); while (each.hasNext()) { E e = each.next(); if (filter.test(e)) { int value = map.get(e); each.remove(); rmap.remove(value); removed = true; } } return removed; }
public Iterator<ItemStack> getCombinedIterator() { if (isCanceled()) return Collections.emptyIterator(); List<Iterable<ItemStack>> inventoriesSorted = Lists.newArrayList(inventories.keySet()); inventoriesSorted.sort(Comparator.comparingInt(inventories::get).reversed()); return new CombinedIterator<>(inventoriesSorted); }
/** * {@inheritDoc} */ public T lookup(int index) { if (index < 0 || index >= indices.size()) return null; assert indices.size() > 0; // If the current lookup table is invalid or has yet to be computed, // recalcuate it while (indexLookup == null || indexLookup.length != indices.size()) { T t = indices.keySet().iterator().next(); @SuppressWarnings("unchecked") T[] tmp = (T[])(Array.newInstance(t.getClass(), indices.size())); TObjectIntIterator<T> iter = indices.iterator(); while (iter.hasNext()) { iter.advance(); tmp[iter.value()] = iter.key(); } // Make the assignment at the end so that the lookup table // construction is atomic in the sense that the table is either // null, or is complete for some length k. Assigning indexLookup // earlier creates the race condition where the null and length // checks pass, but another thread is concurrently filling the // table. indexLookup = tmp; } return indexLookup[index]; }
/** * {@inheritDoc} */ public T lookup(int index) { if (index < 0 || index >= indices.size()) return null; assert indices.size() > 0; // If the current lookup table is invalid or has yet to be computed, // recalcuate it while (indexLookup == null || indexLookup.length != indices.size()) { T t = indices.keySet().iterator().next(); @SuppressWarnings("unchecked") T[] tmp = (T[])(Array.newInstance(t.getClass(), indices.size())); TObjectIntIterator<T> iter = indices.iterator(); while (iter.hasNext()) { iter.advance(); tmp[iter.value()] = iter.key(); } // Make the assignment at the end so that the lookup table // construction is atomic in the sense that the table is either // null, or is complete for some length k. Assigning indexLookup // earlier creates the race condition where the null and length // checks pass, but another thread is concurrently filling the // table. indexLookup = tmp; } return indexLookup[index]; }
RealPropagator[] props = ibexCtr.keySet() .stream() .sorted(Comparator.comparingInt(Propagator::getId))
final Set<TrackedFace> toRemove = new HashSet<TrackedFace>(puppetAssignments.keySet()); toRemove.removeAll(tracked); for (final TrackedFace face : toRemove) {