/** * Deletes all stored values from the cache. In-flight edits will complete normally but their * values will not be stored. */ public synchronized void evictAll() throws IOException { initialize(); // Copying for safe iteration. for (Entry entry : lruEntries.values().toArray(new Entry[lruEntries.size()])) { removeEntry(entry); } mostRecentTrimFailed = false; }
public String get(int idx) { if (idx >= 0 && idx < map.size()) { Iterator<Map.Entry<String, String>> argsIterator = map.entrySet().iterator(); for (int i = 0; i < idx; i++) { argsIterator.next(); } Map.Entry<String, String> e = argsIterator.next(); return e.getValue() != null ? e.getKey() + "=" + e.getValue() : e.getKey(); } else { return null; } }
/** find repeating terms and assign them ordinal values */ private LinkedHashMap<Term,Integer> repeatingTerms() { LinkedHashMap<Term,Integer> tord = new LinkedHashMap<>(); HashMap<Term,Integer> tcnt = new HashMap<>(); for (PhrasePositions pp : phrasePositions) { for (Term t : pp.terms) { Integer cnt0 = tcnt.get(t); Integer cnt = cnt0==null ? Integer.valueOf(1) : Integer.valueOf(1+cnt0.intValue()); tcnt.put(t, cnt); if (cnt==2) { tord.put(t,tord.size()); } } } return tord; }
private static Collection<Path> hitsToPaths( Collection<Hit> depthHits, Node start, Node end, boolean stopAsap, int maxResultCount ) { LinkedHashMap<String,Path> paths = new LinkedHashMap<>(); for ( Hit hit : depthHits ) { for ( Path path : hitToPaths( hit, start, end, stopAsap ) ) { paths.put( path.toString(), path ); if ( paths.size() >= maxResultCount ) { break; } } } return paths.values(); }
address2Ids.put(getSingleShortNodeDefinition(singleNodeMatcher), null); final String hostname = matcher.group( 1 ); final int port = Integer.parseInt( matcher.group( 2 ) ); address2Ids.put(new InetSocketAddress( hostname, port ), null); while (matcher.find()) { final Pair<String, InetSocketAddress> nodeInfo = getRegularNodeDefinition(matcher); address2Ids.put(nodeInfo.getSecond(), nodeInfo.getFirst()); final List<String> failoverNodeIds = initFailoverNodes(failoverNodes, address2Ids.values()); if(address2Ids.size() == 1 && failoverNodeIds.size() >= 1) { throw new IllegalArgumentException("For a single memcached node there should/must no failoverNodes be specified."); for(final Map.Entry<InetSocketAddress, String> address2Id : address2Ids.entrySet()) { final String nodeId = address2Id.getValue(); if (nodeId != null && !failoverNodeIds.contains(nodeId) ) { primaryNodeIds.add(nodeId);
Many(final Credential c1, final Many subsequent) { LinkedHashMap<Key, Credential> map = new LinkedHashMap<>(subsequent.map.size() + 1); map.put(Key.of(c1), c1); map.putAll(subsequent.map); this.map = map; int hc = 0; for (Credential credential : map.values()) { hc ^= typeHash(credential); } hashCode = hc; assert size() > 2; }
if (this.numFields == config.getFieldToSerializerConfigSnapshot().size()) { : config.getFieldToSerializerConfigSnapshot().entrySet()) { int fieldIndex = findField(fieldToConfigSnapshotEntry.getKey()); if (fieldIndex != -1) { reorderedFields[i] = fields[fieldIndex]; fieldToConfigSnapshotEntry.getValue().f0, UnloadableDummyTypeSerializer.class, fieldToConfigSnapshotEntry.getValue().f1, fieldSerializers[fieldIndex]); for (Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>> previousRegisteredSerializerConfig : previousRegistrations.values()) { : config.getNonRegisteredSubclassesToSerializerConfigSnapshots().entrySet()) { TypeSerializer<?> cachedSerializer = createSubclassSerializer(previousCachedEntry.getKey()); previousCachedEntry.getValue().f0, UnloadableDummyTypeSerializer.class, previousCachedEntry.getValue().f1, rebuiltCache.put(previousCachedEntry.getKey(), cachedSerializer); } else { return CompatibilityResult.requiresMigration();
return; int size = _properties.size(); Map<String, POJOPropertyBuilder> all; for (POJOPropertyBuilder prop : _properties.values()) { all.put(prop.getName(), prop); POJOPropertyBuilder w = all.get(name); if (w == null) { // also, as per [JACKSON-268], we will allow use of "implicit" names for (POJOPropertyBuilder prop : _properties.values()) { if (name.equals(prop.getInternalName())) { w = prop;
@Override protected void doSample() { StringBuilder stringBuilder = new StringBuilder(); for (StackTraceElement stackTraceElement : mCurrentThread.getStackTrace()) { stringBuilder .append(stackTraceElement.toString()) .append(BlockInfo.SEPARATOR); } synchronized (sStackMap) { if (sStackMap.size() == mMaxEntryCount && mMaxEntryCount > 0) { sStackMap.remove(sStackMap.keySet().iterator().next()); } sStackMap.put(System.currentTimeMillis(), stringBuilder.toString()); } } }
/** * Copy-constructor that does not copy transient fields. They will be initialized once required. */ protected KryoSerializer(KryoSerializer<T> toCopy) { this.type = checkNotNull(toCopy.type, "Type class cannot be null."); this.defaultSerializerClasses = toCopy.defaultSerializerClasses; this.defaultSerializers = new LinkedHashMap<>(toCopy.defaultSerializers.size()); this.kryoRegistrations = new LinkedHashMap<>(toCopy.kryoRegistrations.size()); // deep copy the serializer instances in defaultSerializers for (Map.Entry<Class<?>, ExecutionConfig.SerializableSerializer<?>> entry : toCopy.defaultSerializers.entrySet()) { this.defaultSerializers.put(entry.getKey(), deepCopySerializer(entry.getValue())); } // deep copy the serializer instances in kryoRegistrations for (Map.Entry<String, KryoRegistration> entry : toCopy.kryoRegistrations.entrySet()) { KryoRegistration kryoRegistration = entry.getValue(); if (kryoRegistration.getSerializerDefinitionType() == KryoRegistration.SerializerDefinitionType.INSTANCE) { ExecutionConfig.SerializableSerializer<? extends Serializer<?>> serializerInstance = kryoRegistration.getSerializableSerializerInstance(); if (serializerInstance != null) { kryoRegistration = new KryoRegistration( kryoRegistration.getRegisteredClass(), deepCopySerializer(serializerInstance)); } } this.kryoRegistrations.put(entry.getKey(), kryoRegistration); } }
@Override public Map<String, Object> _apply(final Element element) { final Map<String, Object> map = new LinkedHashMap<>(fields.size() + constants.size()); for (final Map.Entry<String, String> entry : fields.entrySet()) { final Object value = getFieldValue(element, entry.getKey()); if (null != value) { map.put(entry.getValue(), value); } } map.putAll(constants); return map; }
/** * Deletes all stored values from the cache. In-flight edits will complete normally but their * values will not be stored. */ public synchronized void evictAll() throws IOException { initialize(); // Copying for safe iteration. for (Entry entry : lruEntries.values().toArray(new Entry[lruEntries.size()])) { removeEntry(entry); } mostRecentTrimFailed = false; }
columns.put(column, column); int positionOffset = columns.size(); if (saltBucketNum != null) { positionOffset++; if (columns.put(column, column) != null) { throw new ColumnAlreadyExistsException(schemaName, tableName, column.getName().getString()); .setIndexes(Collections.emptyList()) .setPhysicalNames(ImmutableList.of()) .setColumns(columns.values()) .build(); connection.addTable(table, MetaDataProtocol.MIN_TABLE_TIMESTAMP); linkStatement.setString(2, schemaNameToUse); linkStatement.setString(3, tableNameToUse); linkStatement.setString(4, entry.getKey()); linkStatement.setInt(5, entry.getValue()); linkStatement.execute(); List<Mutation> columnMetadata = Lists.newArrayListWithExpectedSize(columns.size()); boolean isRegularView = (tableType == PTableType.VIEW && viewType!=ViewType.MAPPED); try (PreparedStatement colUpsert = connection.prepareStatement(INSERT_COLUMN_CREATE_TABLE)) { for (Map.Entry<PColumn, PColumn> entry : columns.entrySet()) { PColumn column = entry.getValue(); final int columnPosition = column.getPosition();
Many(final Credential c1, final Credential c2, final Many subsequent) { LinkedHashMap<Key, Credential> map = new LinkedHashMap<>(subsequent.map.size() + 2); map.put(Key.of(c1), c1); map.put(Key.of(c2), c2); map.putAll(subsequent.map); this.map = map; int hc = 0; for (Credential credential : map.values()) { hc ^= typeHash(credential); } hashCode = hc; assert size() > 2; }
StringBuilder name = new StringBuilder(); name.append(domain); if (beanProperties.size() > 0) { name.append(SEP); name.append(beanProperties.values().iterator().next()); if (beanProperties.size() > 1) { Iterator<Map.Entry<String, String>> iter = beanProperties.entrySet().iterator(); String labelName = safeName(entry.getKey()); if (config.lowercaseOutputLabelNames) { labelName = labelName.toLowerCase(); labelValues.add(entry.getValue());
return; int size = _properties.size(); Map<String, POJOPropertyBuilder> all; for (POJOPropertyBuilder prop : _properties.values()) { all.put(prop.getName(), prop); POJOPropertyBuilder w = all.get(name); if (w == null) { // also, as per [JACKSON-268], we will allow use of "implicit" names for (POJOPropertyBuilder prop : _properties.values()) { if (name.equals(prop.getInternalName())) { w = prop;