@Override protected Map<String, String> create(Entry<String, String>[] entries) { Map<String, String> builder = Maps.newLinkedHashMap(); for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } return ImmutableMap.copyOf(builder); } }
private Map<Integer, String> convertKeyToInteger(Map<String, String> map) { Map<Integer, String> result = Maps.newLinkedHashMap(); for (Entry<String, String> entry : map.entrySet()) { result.put(Integer.valueOf(entry.getKey()), entry.getValue()); } return result; }
ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) { rows.put(row, new LinkedHashMap<C, V>()); Map<C, Map<R, V>> columns = Maps.newLinkedHashMap(); for (C col : columnSpace) { columns.put(col, new LinkedHashMap<R, V>()); V value = cell.getValue(); cellRowIndices[i] = rowIndex.get(rowKey); Map<C, V> thisRow = rows.get(rowKey); cellColumnInRowIndices[i] = thisRow.size(); V oldValue = thisRow.put(columnKey, value); checkNoDuplicate(rowKey, columnKey, oldValue, value); columns.get(columnKey).put(rowKey, value); ImmutableMap.Builder<R, ImmutableMap<C, V>> rowBuilder = new ImmutableMap.Builder<>(rows.size()); for (Entry<R, Map<C, V>> row : rows.entrySet()) { rowBuilder.put(row.getKey(), ImmutableMap.copyOf(row.getValue())); for (Entry<C, Map<R, V>> col : columns.entrySet()) { columnBuilder.put(col.getKey(), ImmutableMap.copyOf(col.getValue()));
public Map<String, Diff> diffs() { if (diffs.containsKey(ASSIGNEE)) { Map<String, Diff> result = Maps.newLinkedHashMap(diffs); result.put(ASSIGNEE, decode(result.get(ASSIGNEE))); return result; } return diffs; }
for (Pair<String,Object> prop : props) { if (defaultDescriptor.getValue(prop.getFirst()) == null) { tableProps.put(prop.getFirst(), prop.getSecond()); } else { commonFamilyProps.put(prop.getFirst(), prop.getSecond()); Map<String, PName> familyNames = Maps.newLinkedHashMap(); boolean isPK = false; familyNames.put(column.getFamilyName().getString(),column.getFamilyName()); for (String familyName : statement.getProps().keySet()) { if (!familyName.equals(QueryConstants.ALL_FAMILY_PROPERTIES_KEY)) { if (familyNames.get(familyName) == null) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.PROPERTIES_FOR_FAMILY) .setFamilyName(familyName).build().buildException(); connection.addTable(table); } else if (tableType == PTableType.INDEX) { if (tableProps.get(HTableDescriptor.MAX_FILESIZE) == null) { int nIndexRowKeyColumns = isPK ? 1 : pkColumnsNames.size(); int nIndexKeyValueColumns = columns.size() - nIndexRowKeyColumns;
public SimpleQueryableIndex( Interval dataInterval, Indexed<String> dimNames, BitmapFactory bitmapFactory, Map<String, ColumnHolder> columns, SmooshedFileMapper fileMapper, @Nullable Metadata metadata ) { Preconditions.checkNotNull(columns.get(ColumnHolder.TIME_COLUMN_NAME)); this.dataInterval = Preconditions.checkNotNull(dataInterval, "dataInterval"); ImmutableList.Builder<String> columnNamesBuilder = ImmutableList.builder(); for (String column : columns.keySet()) { if (!ColumnHolder.TIME_COLUMN_NAME.equals(column)) { columnNamesBuilder.add(column); } } this.columnNames = columnNamesBuilder.build(); this.availableDimensions = dimNames; this.bitmapFactory = bitmapFactory; this.columns = columns; this.fileMapper = fileMapper; this.metadata = metadata; this.dimensionHandlers = Maps.newLinkedHashMap(); initDimensionHandlers(); }
@Override public Dag<JobExecutionPlan> compileFlow(Spec spec) { // A Map from JobSpec to SpexExecutor, as the output of Flow Compiler. Map<Spec, SpecExecutor> specExecutorInstanceMap = Maps.newLinkedHashMap(); findPath(specExecutorInstanceMap, spec); List<JobExecutionPlan> jobExecutionPlans = new ArrayList<>(); for (Map.Entry<Spec, SpecExecutor> entry: specExecutorInstanceMap.entrySet()) { JobExecutionPlan jobExecutionPlan = new JobExecutionPlan((JobSpec) entry.getKey(), entry.getValue()); jobExecutionPlans.add(jobExecutionPlan); } return new JobExecutionPlanDagFactory().createDag(jobExecutionPlans); }
/** * Applies all scanners to the modules we've installed. We skip certain PrivateModules because * store them in more than one Modules map and only want to process them through one of the * maps. (They're stored in both maps to prevent a module from being installed more than once.) */ void scanForAnnotatedMethods() { for (ModuleAnnotatedMethodScanner scanner : scanners) { // Note: we must iterate over a copy of the modules because calling install(..) // will mutate modules, otherwise causing a ConcurrentModificationException. for (Map.Entry<Module, ModuleInfo> entry : Maps.newLinkedHashMap(modules).entrySet()) { Module module = entry.getKey(); ModuleInfo info = entry.getValue(); if (info.skipScanning) { continue; } moduleSource = entry.getValue().moduleSource; try { info.binder.install(ProviderMethodsModule.forModule(module, scanner)); } catch (RuntimeException e) { Collection<Message> messages = Errors.getMessagesFromThrowable(e); if (!messages.isEmpty()) { elements.addAll(messages); } else { addError(e); } } } } moduleSource = null; }
ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) { rows.put(row, new LinkedHashMap<C, V>()); Map<C, Map<R, V>> columns = Maps.newLinkedHashMap(); for (C col : columnSpace) { columns.put(col, new LinkedHashMap<R, V>()); V value = cell.getValue(); + oldValue); columns.get(columnKey).put(rowKey, value); ImmutableMap.Builder<R, ImmutableMap<C, V>> rowBuilder = new ImmutableMap.Builder<>(rows.size()); for (Entry<R, Map<C, V>> row : rows.entrySet()) { rowBuilder.put(row.getKey(), ImmutableMap.copyOf(row.getValue())); for (Entry<C, Map<R, V>> col : columns.entrySet()) { columnBuilder.put(col.getKey(), ImmutableMap.copyOf(col.getValue()));
int misses = 0; Map<K, V> result = Maps.newLinkedHashMap(); Set<K> keysToLoad = Sets.newLinkedHashSet(); for (K key : keys) { V value = get(key); if (!result.containsKey(key)) { result.put(key, value); if (value == null) { misses++; Map<K, V> newEntries = loadAll(keysToLoad, defaultLoader); for (K key : keysToLoad) { V value = newEntries.get(key); if (value == null) { throw new InvalidCacheLoadException("loadAll failed to return a value for " + key); result.put(key, value); result.put(key, get(key, defaultLoader));
private Map<Material, Mesh> generateResult() { Map<Material, Mesh> result = Maps.newLinkedHashMap(); for (Map.Entry<Material, MeshBuilder> entry : meshBuilders.entrySet()) { result.put(entry.getKey(), entry.getValue().build()); } return result; }
@Override protected BiMap<String, String> create(Entry<String, String>[] entries) { Map<String, String> builder = Maps.newLinkedHashMap(); for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } return ImmutableBiMap.copyOf(builder); } }
protected Map<String,Object> obtainProvisioningFlags(MachineProvisioningLocation location) { Map<String,Object> result = Maps.newLinkedHashMap(location.getProvisioningFlags(ImmutableList.of(getClass().getName()))); result.putAll(getConfig(PROVISIONING_PROPERTIES)); if (result.get("inboundPorts") == null) { Collection<Integer> ports = getRequiredOpenPorts(); if (ports != null && ports.size() > 0) result.put("inboundPorts", ports); } result.put(LocationConfigKeys.CALLER_CONTEXT.getName(), this); return result; }
LinkedHashMap<String, String> allOverrideProps = Maps.newLinkedHashMap(overrideKylinProps); for (Entry<String, String> entry : prjOverrideProps.entrySet()) { if (!overrideKylinProps.containsKey(entry.getKey())) { allOverrideProps.put(entry.getKey(), entry.getValue());
@Override public LinkedHashMap<String, ClassDef> get() { Set<String> unresolvedInterfaces = new HashSet<String>(0); LinkedHashMap<String, ClassDef> interfaces = Maps.newLinkedHashMap(); try { for (Entry<String, ClassDef> entry: interfaceProto.getInterfaces().entrySet()) { if (!interfaces.containsKey(entry.getKey())) { interfaces.put(entry.getKey(), entry.getValue());
ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) { rows.put(row, new LinkedHashMap<C, V>()); Map<C, Map<R, V>> columns = Maps.newLinkedHashMap(); for (C col : columnSpace) { columns.put(col, new LinkedHashMap<R, V>()); V value = cell.getValue(); + oldValue); columns.get(columnKey).put(rowKey, value); ImmutableMap.Builder<R, ImmutableMap<C, V>> rowBuilder = new ImmutableMap.Builder<>(rows.size()); for (Entry<R, Map<C, V>> row : rows.entrySet()) { rowBuilder.put(row.getKey(), ImmutableMap.copyOf(row.getValue())); for (Entry<C, Map<R, V>> col : columns.entrySet()) { columnBuilder.put(col.getKey(), ImmutableMap.copyOf(col.getValue()));
private Map<String, Map<String, TaskExecutionInfo>> getTasksForJobExecutions(Connection connection, JobExecutionQuery query, Filter tableFilter, Map<String, JobExecutionInfo> jobExecutionInfos) throws SQLException { Map<String, Map<String, TaskExecutionInfo>> taskExecutionInfos = Maps.newLinkedHashMap(); if (query.isIncludeTaskExecutions() && jobExecutionInfos.size() > 0) { String template = String.format(TASK_EXECUTION_QUERY_STATEMENT_TEMPLATE, TaskExecutionInfo taskExecutionInfo = resultSetToTaskExecutionInfo(taskRs); if (!taskExecutionInfos.containsKey(taskExecutionInfo.getJobId())) { taskExecutionInfos.put(taskExecutionInfo.getJobId(), Maps.<String, TaskExecutionInfo>newLinkedHashMap()); taskExecutionInfos.get(taskExecutionInfo.getJobId()).put(taskExecutionInfo.getTaskId(), taskExecutionInfo);
/** * @return a <b>new</b> map with world-based position entries */ public Map<Vector3i, Boolean> getWorldEntries() { Map<Vector3i, Boolean> result = Maps.newLinkedHashMap(); for (Entry<Vector3i, Boolean> entry : relData.entrySet()) { Vector3i relPos = entry.getKey(); Vector3i worldPos = relativeToWorld(relPos.x, relPos.y, relPos.z); result.put(worldPos, entry.getValue()); } return result; } }
@Override public ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException { Map<K, V> result = Maps.newLinkedHashMap(); for (K key : keys) { if (!result.containsKey(key)) { result.put(key, get(key)); } } return ImmutableMap.copyOf(result); }
SafeArg.of("requestingThread", request.getCreatingThreadName())); Map<ClientAwareReadWriteLock, LockMode> locks = Maps.newLinkedHashMap(); if (isShutDown.get()) { throw new ServiceNotAvailableException("This lock server is shut down."); for (Entry<ClientAwareReadWriteLock, LockMode> entry : locks.entrySet()) { lockDescriptorMap.put(entry.getKey().getDescriptor(), entry.getValue()); indefinitelyBlockingThreads.remove(Thread.currentThread()); try { for (Entry<ClientAwareReadWriteLock, LockMode> entry : locks.entrySet()) { entry.getKey().get(client, entry.getValue()).unlock();