List of usage examples for java.util Collections unmodifiableList
public static <T> List<T> unmodifiableList(List<? extends T> list)
From source file:com.eyeq.pivot4j.util.RaggedMemberWrapper.java
/** * @param member/*from w w w . j a v a 2 s .c o m*/ * @param cube */ public RaggedMemberWrapper(Member member, Cube cube) { if (member == null) { throw new NullArgumentException("member"); } int baseDepth = member.getDepth(); if (baseDepth <= 1 || member.getParentMember() != null) { throw new IllegalArgumentException("The specified member does not need a ragged parent placeholder."); } this.baseMember = member; this.nameSegments = Collections.unmodifiableList(IdentifierParser.parseIdentifier(member.getUniqueName())); while (topMember == null && baseDepth > 0) { try { this.topMember = cube.lookupMember(nameSegments.subList(0, baseDepth)); } catch (OlapException e) { throw new PivotException(e); } if (topMember != null) { break; } baseDepth--; } if (topMember == null) { throw new IllegalArgumentException("Unable to find a valid parent of the specified member : " + member); } initialize(baseMember, topMember, nameSegments, member.getLevel()); }
From source file:architecture.common.util.LocaleUtils.java
public static List<Locale> getCandidateLocales(Locale locale) { if (cachedCandidateLocales.containsKey(locale)) return cachedCandidateLocales.get(locale); List<Locale> results = new ArrayList<Locale>(); results.add(locale);// w ww . ja v a 2 s .com if (locale.getVariant().length() > 0) results.add(new Locale(locale.getLanguage(), locale.getCountry())); if (locale.getCountry().length() > 0) results.add(new Locale(locale.getLanguage())); results = Collections.unmodifiableList(results); cachedCandidateLocales.put(locale, results); return results; }
From source file:com.bazaarvoice.jolt.shiftr.ShiftrWriter.java
public ShiftrWriter(String dotNotation) { if (dotNotation.contains("@") || dotNotation.contains("*") || dotNotation.contains("$")) { throw new SpecException("DotNotation (write key) can not contain '@', '*', or '$'."); }/* w w w .j a v a 2 s .c o m*/ List<PathElement> paths; Traversr trav; if (StringUtils.isNotBlank(dotNotation)) { String[] split = dotNotation.split("\\."); paths = ShiftrSpec.parse(split); trav = new ShiftrTraversr(dotNotation); } else { paths = Collections.emptyList(); trav = new ShiftrTraversr(""); } List<EvaluatablePathElement> evalPaths = new ArrayList<EvaluatablePathElement>(paths.size()); for (PathElement pe : paths) { if (!(pe instanceof EvaluatablePathElement)) { throw new SpecException("RHS key=" + pe.getRawKey() + " is not a valid RHS key."); } evalPaths.add((EvaluatablePathElement) pe); } this.elements = Collections.unmodifiableList(evalPaths); this.traversr = trav; }
From source file:com.vmware.identity.openidconnect.protocol.IDToken.java
private IDToken(SignedJWT signedJwt) throws ParseException { super(TOKEN_CLASS, signedJwt); this.signedJwt = signedJwt; JWTClaimsSet claims = JWTUtils.getClaimsSet(this.signedJwt); String[] groupsStringArray = null; if (claims.getClaims().containsKey("groups")) { groupsStringArray = JWTUtils.getStringArray(claims, TOKEN_CLASS, "groups"); }//from w w w . j a v a 2s . c om this.groups = (groupsStringArray == null) ? null : Collections.unmodifiableList(Arrays.asList(groupsStringArray)); String givenName = null; if (claims.getClaims().containsKey("given_name")) { givenName = JWTUtils.getString(claims, TOKEN_CLASS, "given_name"); } this.givenName = givenName; String familyName = null; if (claims.getClaims().containsKey("family_name")) { familyName = JWTUtils.getString(claims, TOKEN_CLASS, "family_name"); } this.familyName = familyName; }
From source file:com.neelo.glue.ApplicationModule.java
public final void configure(Binder binder) { this.routes = new ArrayList<Route>(); this.ids = new HashMap<String, Route>(); binder.bind(RequestResolver.class).toInstance(this); binder.bind(ResponseResolver.class).to(DefaultResponseResolver.class); routes();/* w w w.j a v a 2 s. co m*/ this.routes = Collections.unmodifiableList(routes); for (Route route : routes) { if (route.getName() != null) { ids.put(route.getName(), route); } } this.ids = Collections.unmodifiableMap(ids); Module[] additional = install(); for (Module module : additional) { binder.install(module); } }
From source file:com.github.fritaly.svngraph.Revision.java
public List<Update> getUpdates() { return Collections.unmodifiableList(updates); }
From source file:lda.inference.internal.Topics.java
List<Pair<String, Double>> getVocabsSortedByPhi(int topicID, Vocabularies vocabs, final double beta) { if (topicID < 0 || topics.size() <= topicID || vocabs == null || beta <= 0.0) { throw new IllegalArgumentException(); }/*from w w w . j av a2 s. co m*/ Topic topic = topics.get(topicID); List<Pair<String, Double>> vocabProbPairs = vocabs.getVocabularyList().stream() .map(v -> new ImmutablePair<String, Double>(v.toString(), topic.getPhi(v.id(), beta))) .sorted((p1, p2) -> Double.compare(p2.getRight(), p1.getRight())).collect(Collectors.toList()); return Collections.unmodifiableList(vocabProbPairs); }
From source file:gov.nih.nci.caarray.validation.ValidationResult.java
/** * Returns the messages of given type, ordered by file and location. * // ww w. jav a 2s .co m * @param type type of messages to return * @return the messages. */ public List<ValidationMessage> getMessages(ValidationMessage.Type type) { final List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); for (final FileValidationResult fileValidationResult : getFileValidationResults()) { messages.addAll(fileValidationResult.getMessages(type)); } return Collections.unmodifiableList(messages); }
From source file:com.creactiviti.piper.core.MapObject.java
@Override public <T> List<T> getList(Object aKey, Class<T> aElementType) { List list = get(aKey, List.class); if (list == null) { return null; }// w w w . j a v a2 s . c om List<T> typedList = new ArrayList<>(); for (Object item : list) { if (aElementType.equals(Accessor.class) || aElementType.equals(MapObject.class)) { typedList.add((T) new MapObject((Map<String, Object>) item)); } else { typedList.add((T) ConvertUtils.convert(item, aElementType)); } } return Collections.unmodifiableList(typedList); }
From source file:com.act.lcms.db.model.BaseDBModel.java
protected List<String> makeInsertUpdateFields() { List<String> allFields = getAllFields(); return Collections.unmodifiableList(allFields.subList(1, allFields.size())); }