List of usage examples for java.util Collections unmodifiableCollection
public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c)
From source file:at.yawk.buycraft.BuycraftApiImpl.java
@Override public Set<Purchase> payments(String limit, Optional<String> user) throws IOException { URIBuilder builder = new URIBuilder(); builder.setParameter("limit", limit); user.ifPresent(u -> builder.setParameter("ign", u)); JsonObject object = get("payments", builder); Set<Purchase> purchases = new HashSet<>(); object.getAsJsonArray("payload").forEach(ele -> { JsonObject entry = ele.getAsJsonObject(); List<Integer> packages = new ArrayList<>(); entry.getAsJsonArray("packages").forEach(pack -> packages.add(pack.getAsInt())); Purchase purchase = new Purchase(entry.get("time").getAsLong(), entry.get("humanTime").getAsString(), entry.get("ign").getAsString(), entry.get("uuid").getAsString(), entry.get("price").getAsString(), entry.get("currency").getAsString(), Collections.unmodifiableCollection(packages)); purchases.add(purchase);/*from ww w. j av a 2 s. c o m*/ }); return purchases; }
From source file:greenapi.core.model.resources.net.NetworkInterfaces.java
/** * Returns an unmodifiable {@link Collection} with the network interfaces of an machine. * /* ww w . j ava 2 s. co m*/ * @return An read-only {@link Collection} with the network interfaces of an machine */ public Collection<NetworkInterface> interfaces() { return Collections.unmodifiableCollection(this.interfaces.values()); }
From source file:com.github.jrh3k5.plugin.maven.l10n.data.AuthoritativeMessagesProperties.java
/** * Create an authoritative messages properties object. * // ww w. j a v a2 s . co m * @param file * The {@link File} represented by this object. * @param supportedLocale * The {@link Locale} supported by these properties; can be {@code null}. * @param translationKeys * The translation keys contained in this properties file. * @param duplicateTranslationKeys * The duplicate translation keys contained in this file. */ private AuthoritativeMessagesProperties(File file, Locale supportedLocale, Set<String> translationKeys, Set<String> duplicateTranslationKeys) { super(file, supportedLocale, translationKeys, duplicateTranslationKeys); this.translationClasses = Collections.unmodifiableCollection(parseTranslationClasses(translationKeys)); }
From source file:com.vmware.identity.session.impl.SessionManagerImpl.java
@Override public Collection<Session> getAll() { log.debug("Returning all sessions"); this.lock.lock(); try {/* w ww .ja v a 2 s .c o m*/ return Collections.unmodifiableCollection(this.sessions.values()); } finally { this.lock.unlock(); } }
From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.tbox.RBox.java
@Override public Collection<R> getEquivalentRoles(R role) { if (!hasRole(role)) { throw new IllegalArgumentException(String.format("Unknown role `%s'", role)); }//from w w w. j ava 2 s. c o m final Collection<R> roles = _equivalentRoles.get(role); if (roles != null) { return Collections.unmodifiableCollection(roles); } else { return null; } }
From source file:org.onehippo.forge.solr.indexer.task.SolrConfiguration.java
/** * Constructor/* ww w. j a v a2 s . co m*/ * @param session JCR session * @param solrFilterProperties Solr filter properties */ public SolrConfiguration(Session session, Map<String, String> solrFilterProperties) { Assert.notNull(session, "session must not be null"); Collection<String> n = new HashSet<String>(); Map<String, String> p = new HashMap<String, String>(solrFilterProperties); try { // Read configuration nodes NodeIterator ni = session.getWorkspace().getQueryManager().createQuery(QUERY, Query.SQL).execute() .getNodes(); while (ni.hasNext()) { Node node = ni.nextNode(); log.info("Loading Solr configuration from node {}", JcrUtils.getPath(node)); // Read nodes to index from configuration if (node.hasProperty(Namespace.PROPERTY_NODE)) { for (Value value : node.getProperty(Namespace.PROPERTY_NODE).getValues()) { String nodeName = StringUtils.trimToNull(value.getString()); if (nodeName != null) { n.add(nodeName); } } } // Read properties to index from configuration if (node.hasProperty(Namespace.PROPERTY_PROPERTY)) { for (Value value : node.getProperty(Namespace.PROPERTY_PROPERTY).getValues()) { String propertyName = StringUtils.trimToNull(value.getString()); if (propertyName != null) { p.put("dynamic_" + WRONG_CHARACTER_PATTERN_FOR_SOLR_ID.matcher(propertyName).replaceAll("_"), propertyName); } } } } } catch (RepositoryException e) { log.error("An error occurred while loading the Solr configuration", e); } nodes = Collections.unmodifiableCollection(n); properties = Collections.unmodifiableMap(p); this.session = session; }
From source file:cl.ucn.disc.zoome.zui.layout.OrderedSparseGraph.java
public Collection<E> getOutEdges(V vertex) { if (!containsVertex(vertex)) return null; // combine directed outedges and undirected Collection<E> out = new HashSet<E>(vertex_maps.get(vertex)[OUTGOING].values()); out.addAll(vertex_maps.get(vertex)[INCIDENT].values()); return Collections.unmodifiableCollection(out); }
From source file:cloudfoundry.norouter.f5.client.VirtualServer.java
private VirtualServer(Builder builder) { this.name = builder.name; this.description = builder.description; this.destination = builder.destination; this.mask = builder.mask; this.ipProtocol = builder.ipProtocol; this.rules = Collections.unmodifiableCollection(new ArrayList<>(builder.rules)); this.sourceAddressTranslation = builder.sourceAddressTranslation; this.profiles = new SubCollection<>(null, builder.profiles); this.pool = builder.pool; this.source = builder.source; validate();/*from w w w . ja v a 2s . co m*/ }
From source file:edu.uci.ics.jung.graph.DirectedSparseMultigraph.java
public Collection<V> getNeighbors(V vertex) { if (!containsVertex(vertex)) return null; Collection<V> neighbors = new HashSet<V>(); for (E edge : getIncoming_internal(vertex)) neighbors.add(this.getSource(edge)); for (E edge : getOutgoing_internal(vertex)) neighbors.add(this.getDest(edge)); return Collections.unmodifiableCollection(neighbors); }
From source file:graph.DependencyDirectedSparceMultiGraph.java
public Collection<V> getPredecessors(V vertex) { Set<V> preds = new HashSet<V>(); for (E edge : getIncoming_internal(vertex)) preds.add(this.getSource(edge)); return Collections.unmodifiableCollection(preds); }