Refine search
JdkBackedSetBuilderImpl(SetBuilderImpl<E> toCopy) { super(toCopy); // initializes dedupedElements and distinct delegate = Sets.newHashSetWithExpectedSize(distinct); for (int i = 0; i < distinct; i++) { delegate.add(dedupedElements[i]); } }
result.put(v.getVertexId().getId(), Sets.newHashSet()); } else { Set<Integer> set = Sets.newHashSetWithExpectedSize(vc); for (Vertex outV : out.keySet()) { set.add(outV.getVertexId().getId()); Set<Integer> processed = Sets.newHashSetWithExpectedSize(vc); while (!queue.isEmpty()) { TezVertexID id = queue.poll(); processed.add(num); Set<Integer> deps = result.get(num); Map<Vertex, Edge> in = v.getInputVertices();
@Override public Set<Node> getNodes() { Set<Node> s = Sets.newHashSetWithExpectedSize(partitionToNode.length); for(Node n: this.partitionToNode) s.add(n); return s; }
JdkBackedSetBuilderImpl(SetBuilderImpl<E> toCopy) { super(toCopy); // initializes dedupedElements and distinct delegate = Sets.newHashSetWithExpectedSize(distinct); for (int i = 0; i < distinct; i++) { delegate.add(dedupedElements[i]); } }
@Override public boolean retainAll(Collection<?> c) { try { return super.retainAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { // if the iterators don't support remove Set<Object> keys = Sets.newHashSetWithExpectedSize(c.size()); for (Object o : c) { if (contains(o)) { Entry<?, ?> entry = (Entry<?, ?>) o; keys.add(entry.getKey()); } } return map().keySet().retainAll(keys); } } }
public static Set<String> toStringSet(Set<ServerStatus.Capability> capabilities) { final Set<String> stringSet = Sets.newHashSetWithExpectedSize(capabilities.size()); for (ServerStatus.Capability capability : capabilities) { stringSet.add(capability.toString()); } return stringSet; } }
@Override public boolean retainAll(Collection<?> c) { try { return super.retainAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { // if the iterators don't support remove Set<Object> keys = Sets.newHashSetWithExpectedSize(c.size()); for (Object o : c) { if (contains(o)) { Entry<?, ?> entry = (Entry<?, ?>) o; keys.add(entry.getKey()); } } return map().keySet().retainAll(keys); } } }
MouseInput(InputType type, int id, String name, String displayName, String... alternateStrings) { this.type = type; this.id = id; this.name = name.toUpperCase(Locale.ENGLISH); this.displayName = displayName; this.identifiers = Sets.newHashSetWithExpectedSize(alternateStrings.length + 2); this.identifiers.add(name); this.identifiers.add(toString().toUpperCase(Locale.ENGLISH)); }
/** @return the set of qualified modes used to access the chain of rides ending with the given ride. */ private Set<QualifiedMode> accessModesForRide(Ride ride) { Collection<StopAtDistance> sds = fromStopPaths.get(ride.getAccessStopCluster()); Set<QualifiedMode> qmodes = Sets.newHashSetWithExpectedSize(sds.size()); for (StopAtDistance sd : sds) { qmodes.add(sd.qmode); } return qmodes; }
private Set<Element> createData() { Set<Element> set = Sets.newHashSetWithExpectedSize(size); while (set.size() < size) { set.add(newElement()); } return set; }
@Override public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); for (ConsoleCommand command : commands) { suggestions.add(command.getName()); } return suggestions; } }
private Set<ByteArray> filter(Set<ByteArray> equalValues, ByteArray beginValue, ByteArray endValue) { Set<ByteArray> result = Sets.newHashSetWithExpectedSize(equalValues.size()); for (ByteArray v : equalValues) { if (rangeStartEndComparator.comparator.compare(beginValue, v) <= 0 && rangeStartEndComparator.comparator.compare(v, endValue) <= 0) { result.add(v); } } return equalValues; }
static void checkExactMatches(CharMatcher m, char[] chars) { Set<Character> positive = Sets.newHashSetWithExpectedSize(chars.length); for (char c : chars) { positive.add(c); } for (int c = 0; c <= Character.MAX_VALUE; c++) { assertFalse(positive.contains(new Character((char) c)) ^ m.matches((char) c)); } }
@Override public boolean retainAll(Collection<?> c) { try { return super.retainAll(checkNotNull(c)); } catch (UnsupportedOperationException e) { // if the iterators don't support remove Set<Object> keys = Sets.newHashSetWithExpectedSize(c.size()); for (Object o : c) { if (contains(o)) { Entry<?, ?> entry = (Entry<?, ?>) o; keys.add(entry.getKey()); } } return map().keySet().retainAll(keys); } } }
public Set<T> mapValues(String col, Set<T> values, String returnCol) { int colIdx = tableDesc.findColumnByName(col).getZeroBasedIndex(); int returnIdx = tableDesc.findColumnByName(returnCol).getZeroBasedIndex(); Set<T> result = Sets.newHashSetWithExpectedSize(values.size()); for (T[] row : data.values()) { if (values.contains(row[colIdx])) { result.add(row[returnIdx]); } } return result; }
@GET @RequiresPermissions(RestPermissions.ROLES_READ) @ApiOperation("List all roles") public RolesResponse listAll() throws NotFoundException { final Set<Role> roles = roleService.loadAll(); Set<RoleResponse> roleResponses = Sets.newHashSetWithExpectedSize(roles.size()); for (Role role : roles) { roleResponses.add(RoleResponse.create(role.getName(), Optional.ofNullable(role.getDescription()), role.getPermissions(), role.isReadOnly())); } return RolesResponse.create(roleResponses); }
@GET @Timed @ApiOperation(value = "Get list of message fields that exist", notes = "This operation is comparably fast because it reads directly from the indexer mapping.") @RequiresPermissions(RestPermissions.FIELDNAMES_READ) @Produces(APPLICATION_JSON) public Map<String, Set<String>> fields(@ApiParam(name = "limit", value = "Maximum number of fields to return. Set to 0 for all fields.", required = false) @QueryParam("limit") int limit) { boolean unlimited = limit <= 0; final String[] writeIndexWildcards = indexSetRegistry.getIndexWildcards(); final Set<String> fields; if (unlimited) { fields = indices.getAllMessageFields(writeIndexWildcards); } else { fields = Sets.newHashSetWithExpectedSize(limit); addStandardFields(fields); int i = 0; for (String field : indices.getAllMessageFields(writeIndexWildcards)) { if (i == limit) { break; } fields.add(field); i++; } } return ImmutableMap.of("fields", fields); }
protected Set<IndexRangeSummary> indexRangeListToValueList(Set<IndexRange> indexRanges) { final Set<IndexRangeSummary> result = Sets.newHashSetWithExpectedSize(indexRanges.size()); for (IndexRange indexRange : indexRanges) { result.add(IndexRangeSummary.create( indexRange.indexName(), indexRange.begin(), indexRange.end(), indexRange.calculatedAt(), indexRange.calculationDuration())); } return result; }
@ApiOperation("Get all pipeline connections") @GET @RequiresPermissions(PipelineRestPermissions.PIPELINE_CONNECTION_READ) public Set<PipelineConnections> getAll() throws NotFoundException { final Set<PipelineConnections> pipelineConnections = connectionsService.loadAll(); final Set<PipelineConnections> filteredConnections = Sets.newHashSetWithExpectedSize(pipelineConnections.size()); for (PipelineConnections pc : pipelineConnections) { // only include the streams the user can see if (isPermitted(RestPermissions.STREAMS_READ, pc.streamId())) { // filter out all pipelines the user does not have enough permissions to see filteredConnections.add(PipelineConnections.create( pc.id(), pc.streamId(), pc.pipelineIds() .stream() .filter(id -> isPermitted(PipelineRestPermissions.PIPELINE_READ, id)) .collect(Collectors.toSet())) ); } } return filteredConnections; }
public Set<Long> generateMandatoryCuboids(List<Set<String>> mandatoryDimensionSetList) { Map<String, RowKeyColDesc> rowKeyColDescMap = Maps.newHashMap(); for (RowKeyColDesc entry : getRowkey().getRowKeyColumns()) { rowKeyColDescMap.put(entry.getColumn(), entry); } Set<Long> mandatoryCuboids = Sets.newHashSetWithExpectedSize(mandatoryDimensionSetList.size()); for (Set<String> mandatoryDimensionSet : mandatoryDimensionSetList) { long cuboid = 0L; for (String columnName : mandatoryDimensionSet) { TblColRef tblColRef = model.findColumn(columnName); RowKeyColDesc rowKeyColDesc = rowKeyColDescMap.get(tblColRef.getIdentity()); // check if mandatory dimension set list is valid if (rowKeyColDesc == null) { logger.warn("Column " + columnName + " in " + mandatoryDimensionSet + " does not exist"); throw new IllegalStateException( "Column " + columnName + " in " + mandatoryDimensionSet + " does not exist"); } cuboid |= 1L << rowKeyColDesc.getBitIndex(); } mandatoryCuboids.add(cuboid); } return mandatoryCuboids; }