List of usage examples for java.util Collections unmodifiableList
public static <T> List<T> unmodifiableList(List<? extends T> list)
From source file:net.sf.jabref.model.entry.CustomEntryType.java
@Override public List<String> getOptionalFields() { return Collections.unmodifiableList(optional); }
From source file:eu.stratosphere.nephele.streaming.taskmanager.runtime.chaining.StreamChainCoordinator.java
public StreamChain constructStreamChain(List<ExecutionVertexID> vertexIDs) { ArrayList<StreamChainLink> chainLinkList = new ArrayList<StreamChainLink>(); for (ExecutionVertexID vertexID : vertexIDs) { StreamTaskEnvironment taskEnvironment = this.chainLinks.get(vertexID); if (taskEnvironment == null) { LOG.error("Cannot construct stream chain from " + vertexIDs.get(0) + " to " + vertexIDs.get(vertexIDs.size() - 1) + ": No chain link for vertex ID " + vertexID); return null; }/* w ww .j av a 2 s . com*/ chainLinkList.add(new StreamChainLink(taskEnvironment.getMapper(), taskEnvironment.getInputGate(0), taskEnvironment.getOutputGate(0))); } return new StreamChain(Collections.unmodifiableList(chainLinkList)); }
From source file:net.dv8tion.jda.client.entities.impl.JDAClientImpl.java
@Override public List<Group> getGroupsByName(String name, boolean ignoreCase) { return Collections.unmodifiableList(groups.valueCollection().stream() .filter(g -> g.getName() != null && (ignoreCase ? g.getName().equalsIgnoreCase(name) : g.getName().equals(name))) .collect(Collectors.toList())); }
From source file:com.anrisoftware.simplerest.oanda.core.Granularities.java
private List<Granularity> getGranularities(Set<String> granularites) { Set<Granularity> sorted = new TreeSet<Granularity>(new Comparator<Granularity>() { @Override/*from w w w . j a v a2s. c o m*/ public int compare(Granularity o1, Granularity o2) { return o1.getDuration().compareTo(o2.getDuration()); } }); for (String name : granularites) { sorted.add(Granularity.valueOf(name)); } List<Granularity> result = new ArrayList<Granularity>(sorted.size()); for (Granularity granularity : sorted) { result.add(granularity); } return Collections.unmodifiableList(result); }
From source file:dk.deck.resolver.ArtifactResolverRemote.java
public ArtifactResolverRemote(List<String> repositories, String username, String password) { this.repositories = Collections.unmodifiableList(repositories); PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(); connectionManager.setMaxTotal(MAX_HTTP_THREADS); connectionManager.setDefaultMaxPerRoute(MAX_HTTP_THREADS); httpclient = new DefaultHttpClient(connectionManager); List<String> authpref = new ArrayList<String>(); authpref.add(AuthPolicy.BASIC);/*from w w w . j a va 2 s. c om*/ authpref.add(AuthPolicy.DIGEST); httpclient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, authpref); UsernamePasswordCredentials creds = new UsernamePasswordCredentials(username, password); httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds); }
From source file:net.dv8tion.jda.core.entities.impl.VoiceChannelImpl.java
@Override public List<Member> getMembers() { return Collections.unmodifiableList(new ArrayList<>(connectedMembers.values())); }
From source file:com.mebigfatguy.clytemnestra.StressTestData.java
public List<KeySpaceData> getKeySpaceData() { return Collections.unmodifiableList(keySpaceData); }
From source file:com.skcraft.launcher.creator.util.ModInfoReader.java
/** * Detect the mods listed in the given .jar * * @param file The file// w w w .j a va2 s . c om * @return A list of detected mods */ public List<? extends ModInfo> detectMods(File file) { Closer closer = Closer.create(); try { FileInputStream fis = closer.register(new FileInputStream(file)); BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); ZipInputStream zis = closer.register(new ZipInputStream(bis)); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (entry.getName().equalsIgnoreCase(FORGE_INFO_FILENAME)) { List<ForgeModInfo> mods; String content = CharStreams.toString(new InputStreamReader(zis, Charsets.UTF_8)); try { mods = mapper.readValue(content, ForgeModManifest.class).getMods(); } catch (JsonMappingException | JsonParseException e) { mods = mapper.readValue(content, new TypeReference<List<ForgeModInfo>>() { }); } if (mods != null) { // Ignore "examplemod" return Collections.unmodifiableList( mods.stream().filter(info -> !info.getModId().equals("examplemod")) .collect(Collectors.toList())); } else { return Collections.emptyList(); } } else if (entry.getName().equalsIgnoreCase(LITELOADER_INFO_FILENAME)) { String content = CharStreams.toString(new InputStreamReader(zis, Charsets.UTF_8)); return new ImmutableList.Builder<ModInfo>() .add(mapper.readValue(content, LiteLoaderModInfo.class)).build(); } } return Collections.emptyList(); } catch (JsonMappingException e) { log.log(Level.WARNING, "Unknown format " + FORGE_INFO_FILENAME + " file in " + file.getAbsolutePath(), e); return Collections.emptyList(); } catch (JsonParseException e) { log.log(Level.WARNING, "Corrupt " + FORGE_INFO_FILENAME + " file in " + file.getAbsolutePath(), e); return Collections.emptyList(); } catch (IOException e) { log.log(Level.WARNING, "Failed to read " + file.getAbsolutePath(), e); return Collections.emptyList(); } finally { try { closer.close(); } catch (IOException ignored) { } } }
From source file:com.hp.alm.ali.idea.ui.MultiValueSelectorLabel.java
public List<String> getValues() { return Collections.unmodifiableList(items); }
From source file:io.kazuki.v0.store.schema.model.IndexDefinition.java
@JsonCreator public IndexDefinition(@JsonProperty("name") String name, @JsonProperty("cols") List<IndexAttribute> cols, @JsonProperty("unique") @Nullable Boolean unique, @JsonProperty("renameOf") @Nullable String renameOf) { Preconditions.checkNotNull(name, "name"); Preconditions.checkNotNull(cols, "cols"); Preconditions.checkArgument(!cols.isEmpty(), "cols"); this.name = name; this.unique = (unique != null && unique); List<String> newAttributeNames = new ArrayList<String>(); Map<String, IndexAttribute> newIndexAttributeMap = new LinkedHashMap<String, IndexAttribute>(); for (IndexAttribute attr : cols) { String attrName = attr.getName(); if (newIndexAttributeMap.containsKey(attrName)) { throw new IllegalArgumentException("index definition contains duplicate attribute: " + attrName); }/*from w w w .j a v a 2s .c om*/ newAttributeNames.add(attrName); newIndexAttributeMap.put(attrName, attr); } if (newIndexAttributeMap.containsKey("id")) { throw new IllegalArgumentException("index definition must not contain 'id' attribute"); } this.indexColumns = Collections.unmodifiableList(cols); this.attributeNames = Collections.unmodifiableList(newAttributeNames); this.indexAttributeMap = Collections.unmodifiableMap(newIndexAttributeMap); this.renameOf = renameOf; }