Java Code Examples for java.util.Map#copyOf()
The following examples show how to use
java.util.Map#copyOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryPoolInfo.java From presto with Apache License 2.0 | 6 votes |
@JsonCreator public MemoryPoolInfo( @JsonProperty("maxBytes") long maxBytes, @JsonProperty("reservedBytes") long reservedBytes, @JsonProperty("reservedRevocableBytes") long reservedRevocableBytes, @JsonProperty("queryMemoryReservations") Map<QueryId, Long> queryMemoryReservations, @JsonProperty("queryMemoryAllocations") Map<QueryId, List<MemoryAllocation>> queryMemoryAllocations, @JsonProperty("queryMemoryRevocableReservations") Map<QueryId, Long> queryMemoryRevocableReservations) { this.maxBytes = maxBytes; this.reservedBytes = reservedBytes; this.reservedRevocableBytes = reservedRevocableBytes; this.queryMemoryReservations = Map.copyOf(queryMemoryReservations); this.queryMemoryAllocations = Map.copyOf(queryMemoryAllocations); this.queryMemoryRevocableReservations = Map.copyOf(queryMemoryRevocableReservations); }
Example 2
Source File: LockedApplication.java From vespa with Apache License 2.0 | 6 votes |
private LockedApplication(Lock lock, TenantAndApplicationId id, Instant createdAt, DeploymentSpec deploymentSpec, ValidationOverrides validationOverrides, Optional<IssueId> deploymentIssueId, Optional<IssueId> ownershipIssueId, Optional<User> owner, OptionalInt majorVersion, ApplicationMetrics metrics, Set<PublicKey> deployKeys, OptionalLong projectId, Optional<ApplicationVersion> latestVersion, Map<InstanceName, Instance> instances) { this.lock = lock; this.id = id; this.createdAt = createdAt; this.deploymentSpec = deploymentSpec; this.validationOverrides = validationOverrides; this.deploymentIssueId = deploymentIssueId; this.ownershipIssueId = ownershipIssueId; this.owner = owner; this.majorVersion = majorVersion; this.metrics = metrics; this.deployKeys = deployKeys; this.projectId = projectId; this.latestVersion = latestVersion; this.instances = Map.copyOf(instances); }
Example 3
Source File: ConnectorIdentity.java From presto with Apache License 2.0 | 5 votes |
private ConnectorIdentity( String user, Set<String> groups, Optional<Principal> principal, Optional<SelectedRole> role, Map<String, String> extraCredentials) { this.user = requireNonNull(user, "user is null"); this.groups = Set.copyOf(requireNonNull(groups, "groups is null")); this.principal = requireNonNull(principal, "principal is null"); this.role = requireNonNull(role, "role is null"); this.extraCredentials = Map.copyOf(requireNonNull(extraCredentials, "extraCredentials is null")); }
Example 4
Source File: CustomAnalyzerPanelProvider.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public Map<String, String> getTokenFilterParams(int index) { if (index < 0 || index > tfParamsList.size()) { throw new IllegalArgumentException(); } return Map.copyOf(tfParamsList.get(index)); }
Example 5
Source File: DeploymentMetrics.java From vespa with Apache License 2.0 | 5 votes |
public DeploymentMetrics(double queriesPerSecond, double writesPerSecond, double documentCount, double queryLatencyMillis, double writeLatencyMills, Optional<Instant> instant, Map<Warning, Integer> warnings) { this.queriesPerSecond = queriesPerSecond; this.writesPerSecond = writesPerSecond; this.documentCount = documentCount; this.queryLatencyMillis = queryLatencyMillis; this.writeLatencyMills = writeLatencyMills; this.instant = Objects.requireNonNull(instant, "instant must be non-null"); this.warnings = Map.copyOf(Objects.requireNonNull(warnings, "warnings must be non-null")); if (warnings.entrySet().stream().anyMatch(kv -> kv.getValue() < 0)) { throw new IllegalArgumentException("Warning count must be non-negative. Got " + warnings); } }
Example 6
Source File: AggregationApplicationResult.java From presto with Apache License 2.0 | 5 votes |
public AggregationApplicationResult( T handle, List<ConnectorExpression> projections, List<Assignment> assignments, Map<ColumnHandle, ColumnHandle> groupingColumnMapping) { this.handle = requireNonNull(handle, "handle is null"); requireNonNull(groupingColumnMapping, "goupingSetMapping is null"); requireNonNull(projections, "projections is null"); requireNonNull(assignments, "assignment is null"); this.groupingColumnMapping = Map.copyOf(groupingColumnMapping); this.projections = List.copyOf(projections); this.assignments = List.copyOf(assignments); }
Example 7
Source File: Identity.java From presto with Apache License 2.0 | 5 votes |
private Identity( String user, Set<String> groups, Optional<Principal> principal, Map<String, SelectedRole> roles, Map<String, String> extraCredentials, Optional<Runnable> onDestroy) { this.user = requireNonNull(user, "user is null"); this.groups = Set.copyOf(requireNonNull(groups, "groups is null")); this.principal = requireNonNull(principal, "principal is null"); this.roles = Map.copyOf(requireNonNull(roles, "roles is null")); this.extraCredentials = Map.copyOf(requireNonNull(extraCredentials, "extraCredentials is null")); this.onDestroy = requireNonNull(onDestroy, "onDestroy is null"); }
Example 8
Source File: RestPayloadException.java From catnip with BSD 3-Clause "New" or "Revised" License | 4 votes |
public RestPayloadException(final Map<String, List<String>> failures) { super((String) null); this.failures = Map.copyOf(failures); }
Example 9
Source File: ExpiringAfterWriteCache.java From triplea with GNU General Public License v3.0 | 4 votes |
@Override public Map<IdT, ValueT> asMap() { return Map.copyOf(cache.asMap()); }
Example 10
Source File: RotationStatus.java From vespa with Apache License 2.0 | 4 votes |
private RotationStatus(Map<RotationId, Targets> status) { this.status = Map.copyOf(Objects.requireNonNull(status)); }
Example 11
Source File: SearchResults.java From lucene-solr with Apache License 2.0 | 4 votes |
/** * Returns the field data of this document. */ public Map<String, String[]> getFieldValues() { return Map.copyOf(fieldValues); }
Example 12
Source File: RotationStatus.java From vespa with Apache License 2.0 | 4 votes |
public Targets(Map<ZoneId, RotationState> targets, Instant lastUpdated) { this.targets = Map.copyOf(Objects.requireNonNull(targets, "states must be non-null")); this.lastUpdated = Objects.requireNonNull(lastUpdated, "lastUpdated must be non-null"); }
Example 13
Source File: Analysis.java From lucene-solr with Apache License 2.0 | 4 votes |
/** * Returns value of this attribute. */ public Map<String, String> getAttValues() { return Map.copyOf(attValues); }
Example 14
Source File: ApplicationRepositoryTest.java From vespa with Apache License 2.0 | 4 votes |
public Context(Map<String, ?> point) { this.point = Map.copyOf(point); }
Example 15
Source File: AnalysisSPILoader.java From lucene-solr with Apache License 2.0 | 4 votes |
/** * Reloads the internal SPI list from the given {@link ClassLoader}. * Changes to the service list are visible after the method ends, all * iterators (e.g., from {@link #availableServices()},...) stay consistent. * * <p><b>NOTE:</b> Only new service providers are added, existing ones are * never removed or replaced. * * <p><em>This method is expensive and should only be called for discovery * of new service providers on the given classpath/classloader!</em> */ public synchronized void reload(ClassLoader classloader) { Objects.requireNonNull(classloader, "classloader"); final LinkedHashMap<String,Class<? extends S>> services = new LinkedHashMap<>(this.services); final LinkedHashSet<String> originalNames = new LinkedHashSet<>(this.originalNames); ServiceLoader.load(clazz, classloader).stream().map(ServiceLoader.Provider::type).forEachOrdered(service -> { String name = null; String originalName = null; Throwable cause = null; try { originalName = lookupSPIName(service); name = originalName.toLowerCase(Locale.ROOT); if (!isValidName(originalName)) { throw new ServiceConfigurationError("The name " + originalName + " for " + service.getName() + " is invalid: Allowed characters are (English) alphabet, digits, and underscore. It should be started with an alphabet."); } } catch (NoSuchFieldException | IllegalAccessException | IllegalStateException e) { cause = e; } if (name == null) { throw new ServiceConfigurationError("The class name " + service.getName() + " has no service name field: [public static final String NAME]", cause); } // only add the first one for each name, later services will be ignored // this allows to place services before others in classpath to make // them used instead of others // // TODO: Should we disallow duplicate names here? // Allowing it may get confusing on collisions, as different packages // could contain same factory class, which is a naming bug! // When changing this be careful to allow reload()! if (!services.containsKey(name)) { services.put(name, service); // preserve (case-sensitive) original name for reference originalNames.add(originalName); } }); // make sure that the number of lookup keys is same to the number of original names. // in fact this constraint should be met in existence checks of the lookup map key, // so this is more like an assertion rather than a status check. if (services.keySet().size() != originalNames.size()) { throw new ServiceConfigurationError("Service lookup key set is inconsistent with original name set!"); } this.services = Map.copyOf(services); this.originalNames = Set.copyOf(originalNames); }
Example 16
Source File: BaseIndexFileFormatTestCase.java From lucene-solr with Apache License 2.0 | 4 votes |
/** Get information about which bytes have been read. */ public Map<String, FixedBitSet> getReadBytes() { return Map.copyOf(readBytes); }
Example 17
Source File: SegmentInfo.java From lucene-solr with Apache License 2.0 | 4 votes |
void setDiagnostics(Map<String, String> diagnostics) { this.diagnostics = Map.copyOf(Objects.requireNonNull(diagnostics)); }
Example 18
Source File: NodeTargetVersions.java From vespa with Apache License 2.0 | 4 votes |
@JsonCreator public NodeTargetVersions(@JsonProperty("versions") Map<NodeType, String> vespaVersions, @JsonProperty("osVersions") Map<NodeType, String> osVersions) { this.vespaVersions = Map.copyOf(vespaVersions); this.osVersions = Map.copyOf(osVersions); }
Example 19
Source File: FileReferenceDownloader.java From vespa with Apache License 2.0 | 4 votes |
Map<FileReference, Double> downloadStatus() { synchronized (downloads) { return Map.copyOf(downloadStatus); } }
Example 20
Source File: MappingStrategies.java From ditto with Eclipse Public License 2.0 | 2 votes |
/** * Constructs a new AbstractMappingStrategies object. * * @param strategies the key-value pairs of the returned mapping strategies. * @throws NullPointerException if {@code strategies} is {@code null}. */ protected MappingStrategies(final Map<String, MappingStrategy> strategies) { this.strategies = Map.copyOf(checkNotNull(strategies, "strategies")); }