List of usage examples for java.util NavigableMap get
V get(Object key);
From source file:com.google.cloud.dns.testing.LocalDnsHelper.java
/** * Lists changes. Next page token is the ID of the last change listed. *///from ww w. j a v a 2 s. com @VisibleForTesting Response listChanges(String projectId, String zoneName, String query) { Map<String, Object> options = OptionParsers.parseListChangesOptions(query); Response response = checkListOptions(options); if (response != null) { return response; } ZoneContainer zoneContainer = findZone(projectId, zoneName); if (zoneContainer == null) { return Error.NOT_FOUND.response( String.format("The 'parameters.managedZone' resource named '%s' does not exist", zoneName)); } // take a sorted snapshot of the current change list NavigableMap<Integer, Change> changes = new TreeMap<>(); for (Change c : zoneContainer.changes()) { if (c.getId() != null) { changes.put(Integer.valueOf(c.getId()), c); } } String[] fields = (String[]) options.get("fields"); String sortOrder = (String) options.get("sortOrder"); String pageToken = (String) options.get("pageToken"); Integer maxResults = options.get("maxResults") == null ? null : Integer.valueOf((String) options.get("maxResults")); // as the only supported field is change sequence, we are not reading sortBy NavigableSet<Integer> keys; if ("descending".equals(sortOrder)) { keys = changes.descendingKeySet(); } else { keys = changes.navigableKeySet(); } Integer from = null; try { from = Integer.valueOf(pageToken); } catch (NumberFormatException ex) { // ignore page token } keys = from != null ? keys.tailSet(from, false) : keys; NavigableMap<Integer, Change> fragment = from != null && changes.containsKey(from) ? changes.tailMap(from, false) : changes; boolean sizeReached = false; boolean hasMorePages = false; LinkedList<String> serializedResults = new LinkedList<>(); String lastChangeId = null; for (Integer key : keys) { Change change = fragment.get(key); if (sizeReached) { // we do not add this, just note that there would be more and there should be a token hasMorePages = true; break; } else { lastChangeId = change.getId(); try { serializedResults.addLast(jsonFactory.toString(OptionParsers.extractFields(change, fields))); } catch (IOException e) { return Error.INTERNAL_ERROR.response( String.format("Error when serializing change %s in managed zone %s in project %s", lastChangeId, zoneName, projectId)); } } sizeReached = maxResults != null && maxResults.equals(serializedResults.size()); } boolean includePageToken = hasMorePages && (fields == null || Arrays.asList(fields).contains("nextPageToken")); return toListResponse(serializedResults, "changes", lastChangeId, includePageToken); }
From source file:com.alibaba.wasp.fserver.EntityGroup.java
/** * Use new value replace old value.//from w ww . j av a2s .c o m * * @param oldValues * @param action * @return */ private NavigableMap<byte[], NavigableMap<byte[], byte[]>> prepareUpdateValues( NavigableMap<byte[], NavigableMap<byte[], byte[]>> oldValues, UpdateAction action) { Iterator<ColumnStruct> iterator = action.getColumns().iterator(); while (iterator.hasNext()) { ColumnStruct column = iterator.next(); if (column.isIndex()) { NavigableMap<byte[], byte[]> family = oldValues.get(Bytes.toBytes(column.getFamilyName())); byte[] columnName = Bytes.toBytes(column.getColumnName()); family.put(columnName, column.getValue()); } } return oldValues; }
From source file:com.alibaba.wasp.fserver.EntityGroup.java
/** * Make insert action into transaction;/*from w w w .ja v a 2 s. co m*/ * * @param action * insert action * @param transaction * transaction * @throws java.io.IOException * @throws com.alibaba.wasp.storage.StorageTableNotFoundException */ private void prepareInsertEntity(InsertAction action, Transaction transaction) throws IOException, StorageTableNotFoundException { long before = EnvironmentEdgeManager.currentTimeMillis(); RowBuilder builder = RowBuilder.build(); TableSchemaCacheReader metaReader = TableSchemaCacheReader.getInstance(this.conf); LinkedHashMap<String, Index> indexs = metaReader.getSchema(action.getFTableName()).getIndex(); if (LOG.isDebugEnabled()) { LOG.debug("prepareInsertEntity indexs:" + indexs.values()); } NavigableMap<byte[], NavigableMap<byte[], byte[]>> set = new TreeMap<byte[], NavigableMap<byte[], byte[]>>( Bytes.BYTES_COMPARATOR); for (ColumnStruct col : action.getColumns()) { byte[] family = Bytes.toBytes(col.getFamilyName()); NavigableMap<byte[], byte[]> cols = set.get(family); if (cols == null) { cols = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR); } set.put(family, cols); cols.put(Bytes.toBytes(col.getColumnName()), col.getValue()); } String entityTableName = StorageTableNameBuilder.buildEntityTableName(action.getFTableName()); // entity put Put entityPut = builder.buildPut(action); transaction.addEntity(ProtobufUtil.toMutate(MutateType.PUT, entityPut, entityTableName)); storageServices.checkRowExistsBeforeInsert(action, entityTableName, entityPut); // index put if (indexs != null) { for (Index index : indexs.values()) { Pair<byte[], String> indexPut = builder.buildIndexKey(index, set, entityPut.getRow()); if (indexPut != null) { Put put = new Put(indexPut.getFirst()); put.add(FConstants.INDEX_STORING_FAMILY_BYTES, FConstants.INDEX_STORE_ROW_QUALIFIER, entityPut.getRow()); for (Entry<String, Field> entry : index.getStoring().entrySet()) { ColumnStruct storing = action.getName2Column().get(entry.getKey()); if (storing != null) { put.add(FConstants.INDEX_STORING_FAMILY_BYTES, Bytes.toBytes(entry.getKey()), storing.getValue()); } } transaction.addEntity(ProtobufUtil.toMutate(MutateType.PUT, put, indexPut.getSecond())); } } } if (this.metricsEntityGroup != null) { this.metricsEntityGroup.updatePrepareInsertEntity(EnvironmentEdgeManager.currentTimeMillis() - before); } }
From source file:com.bol.crazypigs.HBaseStorage15.java
@Override public Tuple getNext() throws IOException { try {// w ww . j av a2 s . c om if (reader.nextKeyValue()) { ImmutableBytesWritable rowKey = (ImmutableBytesWritable) reader.getCurrentKey(); Result result = (Result) reader.getCurrentValue(); int tupleSize = columnInfo_.size(); // use a map of families -> qualifiers with the most recent // version of the cell. Fetching multiple vesions could be a // useful feature. NavigableMap<byte[], NavigableMap<byte[], byte[]>> resultsMap = result.getNoVersionMap(); if (loadRowKey_) { tupleSize++; } Tuple tuple = TupleFactory.getInstance().newTuple(tupleSize); int startIndex = 0; if (loadRowKey_) { tuple.set(0, new DataByteArray(rowKey.get())); startIndex++; } for (int i = 0; i < columnInfo_.size(); ++i) { int currentIndex = startIndex + i; ColumnInfo columnInfo = columnInfo_.get(i); if (columnInfo.isColumnMap()) { // It's a column family so we need to iterate and set all // values found NavigableMap<byte[], byte[]> cfResults = resultsMap.get(columnInfo.getColumnFamily()); Map<String, DataByteArray> cfMap = new HashMap<String, DataByteArray>(); if (cfResults != null) { for (byte[] quantifier : cfResults.keySet()) { // We need to check against the prefix filter to // see if this value should be included. We can't // just rely on the server-side filter, since a // user could specify multiple CF filters for the // same CF. if (columnInfo.getColumnPrefix() == null || columnInfo.hasPrefixMatch(quantifier)) { byte[] cell = cfResults.get(quantifier); DataByteArray value = cell == null ? null : new DataByteArray(cell); cfMap.put(Bytes.toString(quantifier), value); } } } tuple.set(currentIndex, cfMap); } else { // It's a column so set the value byte[] cell = result.getValue(columnInfo.getColumnFamily(), columnInfo.getColumnName()); DataByteArray value = cell == null ? null : new DataByteArray(cell); tuple.set(currentIndex, value); } } if (LOG.isDebugEnabled()) { for (int i = 0; i < tuple.size(); i++) { LOG.debug("tuple value:" + tuple.get(i)); } } return tuple; } } catch (InterruptedException e) { throw new IOException(e); } return null; }
From source file:com.rockhoppertech.music.midi.js.MIDITrack.java
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Track Name:").append(name).append('\n'); // if (this.description != null || this.description.equals("")) // sb.append("Description:").append(this.description).append('\n'); // sb.append("Instrument:").append(this.gmpatch).append('\n'); sb.append("Instrument:").append(this.instrument).append('\n'); if (this.notes.size() > 0) { for (MIDINote n : notes) { sb.append(n).append('\n'); }// www .j a va 2s . com } else { sb.append("no notes").append('\n'); } if (this.events.size() > 0) { sb.append("events").append('\n'); for (MIDIEvent n : events) { sb.append(n.toReadableString()).append('\n'); sb.append(n.toString()).append('\n'); } } else { sb.append("no events").append('\n'); } NavigableMap<Double, KeySignature> keys = this.getKeySignatures(); for (Double time : keys.keySet()) { KeySignature key = keys.get(time); sb.append("Key: ").append(key.getDisplayName()).append(" at beat ").append(time).append('\n'); } NavigableMap<Double, TimeSignature> timeSigs = this.getTimeSignatures(); for (Double time : timeSigs.keySet()) { TimeSignature ts = timeSigs.get(time); sb.append("Time signature: ").append(ts.getDisplayName()).append(" at beat ").append(time).append('\n'); } NavigableMap<Double, Integer> tempoMap = this.getTempoMap(); for (Double time : tempoMap.keySet()) { Integer tempo = tempoMap.get(time); sb.append("Tempo: ").append(tempo).append(" at beat ").append(time).append('\n'); } return sb.toString(); }
From source file:com.smartitengineering.cms.spi.impl.type.ContentTypeObjectConverter.java
@Override public PersistentContentType rowsToObject(Result startRow, ExecutorService executorService) { try {// w w w. j a v a 2 s. c o m PersistableContentType contentType = SmartContentSPI.getInstance().getPersistableDomainFactory() .createPersistableContentType(); PersistentContentType persistentContentType = new PersistentContentType(); /* * Simple fields */ persistentContentType.setMutableContentType(contentType); persistentContentType.setVersion(0l); logger.info("::::::::::::::::::::: Converting rowId to ContentTypeId :::::::::::::::::::::"); contentType.setContentTypeID(getInfoProvider().getIdFromRowId(startRow.getRow())); if (logger.isInfoEnabled()) { logger.info(new StringBuilder("ContentTypeId ").append(contentType.getContentTypeID()).toString()); } Map<byte[], byte[]> simpleValues = startRow.getFamilyMap(FAMILY_SIMPLE); byte[] displayName = simpleValues.remove(CELL_DISPLAY_NAME); if (displayName != null) { logger.debug("Set display name of the content type!"); contentType.setDisplayName(Bytes.toString(displayName)); } byte[] primaryFieldName = simpleValues.remove(CELL_PRIMARY_FIELD_NAME); if (primaryFieldName != null) { final String toString = Bytes.toString(primaryFieldName); if (logger.isDebugEnabled()) { logger.debug("Set primary field name of the content type!" + toString); } contentType.setPrimaryFieldName(toString); } byte[] defTyoe = simpleValues.remove(CELL_DEF_TYPE); if (defTyoe != null) { final String toString = Bytes.toString(defTyoe); if (logger.isDebugEnabled()) { logger.debug("Set primary field name of the content type!" + toString); } contentType.setDefinitionType(ContentType.DefinitionType.valueOf(toString)); } contentType.setEntityTagValue(Bytes.toString(simpleValues.remove(CELL_ENTITY_TAG))); logger.debug("Setting creation and last modified date"); contentType.setCreationDate(Utils.toDate(simpleValues.remove(CELL_CREATION_DATE))); contentType.setLastModifiedDate(Utils.toDate(simpleValues.remove(CELL_LAST_MODIFIED_DATE))); final byte[] parentId = simpleValues.remove(CELL_PARENT_ID); if (parentId != null) { logger.debug("Setting parent id"); contentType.setParent(getInfoProvider().getIdFromRowId(parentId)); } if (!simpleValues.isEmpty()) { String displayNamesPrefix = new StringBuilder(CELL_PARAMETERIZED_DISPLAY_NAME_PREFIX).append(':') .toString(); final byte[] toBytes = Bytes.toBytes(CELL_PARAMETERIZED_DISPLAY_NAME_PREFIX); for (Entry<byte[], byte[]> entry : simpleValues.entrySet()) { if (logger.isDebugEnabled()) { logger.debug("Extra simple fields Key " + Bytes.toString(entry.getKey()) + " " + Bytes.startsWith(entry.getKey(), toBytes)); logger.debug("Extra simple fields Value " + Bytes.toString(entry.getValue())); } if (Bytes.startsWith(entry.getKey(), toBytes)) { String paramKey = Bytes.toString(entry.getKey()).substring(displayNamesPrefix.length()); String paramVal = Bytes.toString(entry.getValue()); contentType.getMutableParameterizedDisplayNames().put(paramKey, paramVal); } } } if (logger.isDebugEnabled()) { final FastDateFormat formatter = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT; logger.debug(String.format("Creation date is %s and last modified date is %s", formatter.format(contentType.getCreationDate()), formatter.format(contentType.getLastModifiedDate()))); logger.debug(String.format("Id is %s and parent id is %s", contentType.getContentTypeID().toString(), ObjectUtils.toString(contentType.getParent()))); } /* * Content status */ logger.debug("Form statuses"); NavigableMap<byte[], byte[]> statusMap = startRow.getFamilyMap(FAMILY_STATUSES); int index = 0; for (byte[] statusName : statusMap.navigableKeySet()) { final String statusNameStr = Bytes.toString(statusName); if (logger.isDebugEnabled()) { logger.debug(new StringBuilder("Forming content status for ").append(statusNameStr).toString()); } //Value not required as both are the same for status MutableContentStatus contentStatus = SmartContentAPI.getInstance().getContentTypeLoader() .createMutableContentStatus(); contentStatus.setContentTypeID(contentType.getContentTypeID()); contentStatus.setId(++index); contentStatus.setName(statusNameStr); contentType.getMutableStatuses().add(contentStatus); } /* * Representations */ logger.debug("Form representations!"); NavigableMap<byte[], byte[]> representationMap = startRow.getFamilyMap(FAMILY_REPRESENTATIONS); Map<String, MutableRepresentationDef> reps = new HashMap<String, MutableRepresentationDef>(); for (byte[] keyBytes : representationMap.navigableKeySet()) { final String key = Bytes.toString(keyBytes); if (logger.isDebugEnabled()) { logger.debug(new StringBuilder("Work with key ").append(key).toString()); } final int indexOfFirstColon = key.indexOf(':'); final String repName = key.substring(0, indexOfFirstColon); final byte[] qualifier = Bytes.toBytes(key.substring(indexOfFirstColon + 1)); if (logger.isDebugEnabled()) { logger.debug(new StringBuilder("Representation name ").append(repName).toString()); logger.debug(new StringBuilder("Representation qualifier ").append(Bytes.toString(qualifier)) .toString()); } MutableRepresentationDef representationDef = reps.get(repName); if (representationDef == null) { logger.debug("Creating new representation def and putting to map"); representationDef = SmartContentAPI.getInstance().getContentTypeLoader() .createMutableRepresentationDef(); reps.put(repName, representationDef); representationDef.setName(repName); } final byte[] value = representationMap.get(keyBytes); fillResourceDef(qualifier, representationDef, value); } contentType.getMutableRepresentationDefs().addAll(reps.values()); /* * Content Co-Processors */ logger.debug("Form Content Co-Processors!"); NavigableMap<byte[], byte[]> ccpMap = startRow.getFamilyMap(FAMILY_CCP); Map<String, MutableContentCoProcessorDef> ccps = new HashMap<String, MutableContentCoProcessorDef>(); for (byte[] keyBytes : ccpMap.navigableKeySet()) { final String key = Bytes.toString(keyBytes); if (logger.isDebugEnabled()) { logger.debug(new StringBuilder("CCP Work with key ").append(key).toString()); } final int indexOfFirstColon = key.indexOf(':'); final String ccpName = key.substring(0, indexOfFirstColon); final byte[] qualifier = Bytes.toBytes(key.substring(indexOfFirstColon + 1)); if (logger.isDebugEnabled()) { logger.debug(new StringBuilder("CCP name ").append(ccpName).toString()); logger.debug(new StringBuilder("CCP qualifier ").append(Bytes.toString(qualifier)).toString()); } MutableContentCoProcessorDef ccpDef = ccps.get(ccpName); if (ccpDef == null) { logger.debug("Creating new content co processor def and putting to map"); ccpDef = SmartContentAPI.getInstance().getContentTypeLoader() .createMutableContentCoProcessorDef(); ccps.put(ccpName, ccpDef); ccpDef.setName(ccpName); } final byte[] value = ccpMap.get(keyBytes); if (Arrays.equals(qualifier, CELL_CCP_PHASE)) { ccpDef.setPhase(ContentType.ContentProcessingPhase.valueOf(Bytes.toString(value))); } else if (Arrays.equals(qualifier, CELL_CCP_PRIORITY)) { ccpDef.setPriority(Bytes.toInt(value)); } else { fillResourceDef(qualifier, ccpDef, value); } } List<MutableContentCoProcessorDef> ccpDefs = new ArrayList<MutableContentCoProcessorDef>(ccps.values()); Collections.sort(ccpDefs, new Comparator<ContentCoProcessorDef>() { public int compare(ContentCoProcessorDef o1, ContentCoProcessorDef o2) { return o1.getPriority() - o2.getPriority(); } }); for (MutableContentCoProcessorDef ccpDef : ccpDefs) { contentType.addContentCoProcessorDef(ccpDef); } /* * Fields */ NavigableMap<byte[], byte[]> fieldMap = startRow.getFamilyMap(FAMILY_FIELDS); //From a map of all cells form a map of cells by field name Map<String, Map<String, byte[]>> fieldsByName = new LinkedHashMap<String, Map<String, byte[]>>(); Utils.organizeByPrefix(fieldMap, fieldsByName, ':'); for (String fieldName : fieldsByName.keySet()) { final MutableFieldDef fieldDef = SmartContentAPI.getInstance().getContentTypeLoader() .createMutableFieldDef(); final Map<String, byte[]> fieldCells = fieldsByName.get(fieldName); populateFieldDef(fieldDef, fieldName, fieldCells); contentType.getMutableFieldDefs().add(fieldDef); } /* * Variants of content type */ Map<byte[], byte[]> variants = startRow.getFamilyMap(FAMILY_TYPE_REPRESENTATIONS); if (variants != null && !variants.isEmpty()) { final Map<MediaType, String> variantMap = new HashMap<MediaType, String>(variants.size()); for (byte[] mediaType : variants.keySet()) { variantMap.put(MediaType.fromString(Bytes.toString(mediaType)), Bytes.toString(variants.get(mediaType))); } contentType.setRepresentations(variantMap); contentType.setFromPersistentStorage(true); } return persistentContentType; } catch (Exception ex) { logger.warn("Error converting result to content type, throwing exception...", ex); throw new RuntimeException(ex); } }
From source file:com.mirth.connect.connectors.http.HttpReceiver.java
@Override public void onStart() throws ConnectorTaskException { String channelId = getChannelId(); String channelName = getChannel().getName(); host = replacer.replaceValues(connectorProperties.getListenerConnectorProperties().getHost(), channelId, channelName);//www .j av a 2 s . c o m port = NumberUtils.toInt(replacer.replaceValues( connectorProperties.getListenerConnectorProperties().getPort(), channelId, channelName)); timeout = NumberUtils .toInt(replacer.replaceValues(connectorProperties.getTimeout(), channelId, channelName), 0); // Initialize contextPath to "" or its value after replacements String contextPath = (connectorProperties.getContextPath() == null ? "" : replacer.replaceValues(connectorProperties.getContextPath(), channelId, channelName)).trim(); /* * Empty string and "/" are both valid and equal functionally. However if there is a * resource defined, we need to make sure that the context path starts with a slash and * doesn't end with one. */ if (!contextPath.startsWith("/")) { contextPath = "/" + contextPath; } if (contextPath.endsWith("/")) { contextPath = contextPath.substring(0, contextPath.length() - 1); } try { server = new Server(); configuration.configureReceiver(this); HandlerCollection handlers = new HandlerCollection(); Handler serverHandler = handlers; // Add handlers for each static resource if (connectorProperties.getStaticResources() != null) { NavigableMap<String, List<HttpStaticResource>> staticResourcesMap = new TreeMap<String, List<HttpStaticResource>>(); // Add each static resource to a map first to allow sorting and deduplication for (HttpStaticResource staticResource : connectorProperties.getStaticResources()) { String resourceContextPath = replacer.replaceValues(staticResource.getContextPath(), channelId, channelName); Map<String, List<String>> queryParameters = new HashMap<String, List<String>>(); // If query parameters were specified, extract them here int queryIndex = resourceContextPath.indexOf('?'); if (queryIndex >= 0) { String query = resourceContextPath.substring(queryIndex + 1); resourceContextPath = resourceContextPath.substring(0, queryIndex); for (NameValuePair param : URLEncodedUtils.parse(query, Charset.defaultCharset())) { List<String> currentValue = queryParameters.get(param.getName()); String value = StringUtils.defaultString(param.getValue()); if (currentValue == null) { currentValue = new ArrayList<String>(); queryParameters.put(param.getName(), currentValue); } currentValue.add(value); } } // We always want to append resources starting with "/" to the base context path if (resourceContextPath.endsWith("/")) { resourceContextPath = resourceContextPath.substring(0, resourceContextPath.length() - 1); } if (!resourceContextPath.startsWith("/")) { resourceContextPath = "/" + resourceContextPath; } resourceContextPath = contextPath + resourceContextPath; List<HttpStaticResource> staticResourcesList = staticResourcesMap.get(resourceContextPath); if (staticResourcesList == null) { staticResourcesList = new ArrayList<HttpStaticResource>(); staticResourcesMap.put(resourceContextPath, staticResourcesList); } staticResourcesList .add(new HttpStaticResource(resourceContextPath, staticResource.getResourceType(), staticResource.getValue(), staticResource.getContentType(), queryParameters)); } // Iterate through each context path in reverse so that more specific contexts take precedence for (List<HttpStaticResource> staticResourcesList : staticResourcesMap.descendingMap().values()) { for (HttpStaticResource staticResource : staticResourcesList) { logger.debug("Adding static resource handler for context path: " + staticResource.getContextPath()); ContextHandler resourceContextHandler = new ContextHandler(); resourceContextHandler.setContextPath(staticResource.getContextPath()); // This allows resources to be requested without a relative context path (e.g. "/") resourceContextHandler.setAllowNullPathInfo(true); resourceContextHandler.setHandler(new StaticResourceHandler(staticResource)); handlers.addHandler(resourceContextHandler); } } } // Add the main request handler ContextHandler contextHandler = new ContextHandler(); contextHandler.setContextPath(contextPath); contextHandler.setHandler(new RequestHandler()); handlers.addHandler(contextHandler); // Wrap the handler collection in a security handler if needed if (authenticatorProvider != null) { serverHandler = createSecurityHandler(handlers); } server.setHandler(serverHandler); logger.debug("starting HTTP server with address: " + host + ":" + port); server.start(); eventController.dispatchEvent(new ConnectionStatusEvent(getChannelId(), getMetaDataId(), getSourceName(), ConnectionStatusEventType.IDLE)); } catch (Exception e) { eventController.dispatchEvent(new ConnectionStatusEvent(getChannelId(), getMetaDataId(), getSourceName(), ConnectionStatusEventType.FAILURE)); throw new ConnectorTaskException("Failed to start HTTP Listener", e); } }
From source file:com.google.gwt.emultest.java.util.TreeMapTest.java
public void testPutLjava_lang_ObjectLjava_lang_Object() { K[] keys = getSortedKeys();/* w w w. j a v a 2s . c o m*/ V[] values = getSortedValues(); NavigableMap<K, V> map = createNavigableMap(); assertNull(map.put(keys[0], values[0])); assertTrue(map.get(keys[0]) == values[0]); }
From source file:com.google.gwt.emultest.java.util.TreeMapTest.java
public void testPutAllLjava_util_Map() { K[] keys = getSortedKeys();/*from w w w . j ava 2s .c o m*/ V[] values = getSortedValues(); NavigableMap<K, V> map = createNavigableMap(); for (int i = 0; i < keys.length; i++) { map.put(keys[i], values[i]); } NavigableMap<K, V> newMap = createNavigableMap(); newMap.putAll(map); assertEquals(map.size(), newMap.size()); for (int i = 0; i < keys.length; i++) { V value = values[i]; assertEquals(value, newMap.get(keys[i])); } }