List of usage examples for com.google.common.collect Maps newHashMapWithExpectedSize
public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize)
From source file:org.apache.phoenix.end2end.SysTableNamespaceMappedStatsCollectorIT.java
@BeforeClass public static void doSetup() throws Exception { // enable name space mapping at global level on both client and server side Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(7); serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); serverProps.put(QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE, "true"); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); clientProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); clientProps.put(QueryServices.IS_SYSTEM_TABLE_MAPPED_TO_NAMESPACE, "true"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); }
From source file:com.yunmel.syncretic.utils.commons.CollectionsUtils.java
/** * ????(Getter), ??Map.//from w w w .j ava 2 s . c om * * @param collection ???. * @param keyPropertyName ????MapKey??. * @param valuePropertyName ????MapValue??. */ @SuppressWarnings("unchecked") public static Map extractToMap(final Collection collection, final String keyPropertyName, final String valuePropertyName) { Map map = Maps.newHashMapWithExpectedSize(collection.size()); try { for (Object obj : collection) { map.put(PropertyUtils.getProperty(obj, keyPropertyName), PropertyUtils.getProperty(obj, valuePropertyName)); } } catch (Exception e) { throw Reflections.convertReflectionExceptionToUnchecked(e); } return map; }
From source file:org.apache.phoenix.end2end.BaseViewIT.java
@BeforeClass public static void doSetup() throws Exception { Map<String, String> props = Maps.newHashMapWithExpectedSize(1); props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Integer.toString(20)); props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(1024)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); }
From source file:org.apache.phoenix.end2end.IndexToolForPartialBuildWithNamespaceEnabledIT.java
@BeforeClass @Shadower(classBeingShadowed = IndexToolForPartialBuildIT.class) public static void doSetup() throws Exception { Map<String, String> serverProps = getServerProperties(); serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); }
From source file:org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria.java
private static Map<String, List<String>> createDropConfigurations() { final Map<String, List<String>> config = Maps.newHashMapWithExpectedSize(1); // Delete drop area droppable components config.put(UIComponentIdProvider.DELETE_BUTTON_WRAPPER_ID, Arrays.asList(UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX)); return config; }
From source file:org.matsim.contrib.zone.ZonalSystems.java
public static Map<Id<Zone>, List<Zone>> initZonesByDistance(Map<Id<Zone>, Zone> zones) { Map<Id<Zone>, List<Zone>> zonesByDistance = Maps.newHashMapWithExpectedSize(zones.size()); for (final Zone currentZone : zones.values()) { List<Zone> sortedZones = zones.values().stream()// .sorted(Comparator.comparing(z -> DistanceUtils.calculateSquaredDistance(currentZone, z)))// .collect(Collectors.toList()); zonesByDistance.put(currentZone.getId(), sortedZones); }// www . j a v a2 s.c o m return zonesByDistance; }
From source file:org.sonatype.nexus.orient.entity.FieldCopier.java
@SuppressWarnings("unchecked") public static Map copy(final ODocument source) { String[] names = source.fieldNames(); Map target = Maps.newHashMapWithExpectedSize(names.length); for (String name : names) { Object value = maybeCopy(source.field(name)); target.put(name, value);/* w ww . j a va 2 s.c om*/ } return target; }
From source file:com.google.gcloud.datastore.DatastoreHelper.java
/** * Returns a list with a value for each given key (ordered by input). * A {@code null} would be returned for non-existing keys. *///from w w w.j a v a 2 s . co m static List<Entity> fetch(DatastoreReader reader, Key... keys) { Iterator<Entity> entities = reader.get(keys); Map<Key, Entity> map = Maps.newHashMapWithExpectedSize(keys.length); while (entities.hasNext()) { Entity entity = entities.next(); map.put(entity.key(), entity); } List<Entity> list = new ArrayList<>(keys.length); for (Key key : keys) { // this will include nulls for non-existing keys list.add(map.get(key)); } return list; }
From source file:com.palantir.atlasdb.table.description.Schemas.java
public static void createIndices(KeyValueService kvs, Map<String, IndexDefinition> fullIndexNameToDefinition) { Map<String, byte[]> fullIndexNameToMetadata = Maps .newHashMapWithExpectedSize(fullIndexNameToDefinition.size()); for (Entry<String, IndexDefinition> indexEntry : fullIndexNameToDefinition.entrySet()) { fullIndexNameToMetadata.put(indexEntry.getKey(), indexEntry.getValue().toIndexMetadata(indexEntry.getKey()).getTableMetadata().persistToBytes()); }/*from w w w . j a va 2 s.co m*/ kvs.createTables(fullIndexNameToMetadata); }
From source file:org.apache.phoenix.schema.stats.NamespaceEnabledStatsCollectorIT.java
@BeforeClass public static void doSetup() throws Exception { // enable name space mapping at global level on both client and server side Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(7); serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString()); serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString()); clientProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); }