Example usage for java.util Collections unmodifiableList

List of usage examples for java.util Collections unmodifiableList

Introduction

In this page you can find the example usage for java.util Collections unmodifiableList.

Prototype

public static <T> List<T> unmodifiableList(List<? extends T> list) 

Source Link

Document

Returns an unmodifiable view of the specified list.

Usage

From source file:ch.jamiete.hilda.commands.ChannelSeniorCommand.java

/**
 * Gets the currently-registered subcommands.
 * @return The currently-registered subcommands in an unmodifiable list
 *///from ww w .j  a v a 2  s  .c  om
public List<ChannelCommand> getSubcommands() {
    return Collections.unmodifiableList(this.subcommands);
}

From source file:edu.cmu.sei.ams.cloudlet.impl.CloudletUtilities.java

/**
 * Creates an immutable list based on a comma seperated json string
 * @param name//from www.j a v a 2  s . c  om
 * @param json
 * @return
 */
static List<String> getSafeStringArray(String name, JSONObject json) {
    try {
        if (json.has(name)) {
            JSONArray array = json.getJSONArray(name);
            List<String> ret = new ArrayList<String>();
            for (int x = 0; x < array.length(); x++)
                ret.add(array.getString(x));
            return Collections.unmodifiableList(ret);
        }
    } catch (Exception e) {

    }
    return new ArrayList<String>();
}

From source file:com.thoughtworks.studios.journey.cspmining.Pattern.java

public List<String> getActions() {
    return Collections.unmodifiableList(actions);
}

From source file:org.hawkular.apm.server.api.model.zipkin.Span.java

@JsonCreator
public Span(@JsonProperty("binaryAnnotations") List<BinaryAnnotation> binaryAnnotations,
        @JsonProperty("annotations") List<Annotation> annotations) {
    this.binaryAnnotations = Collections
            .unmodifiableList(binaryAnnotations == null ? Collections.emptyList() : binaryAnnotations);
    this.annotations = Collections
            .unmodifiableList(annotations == null ? Collections.emptyList() : annotations);
    this.mappingResult = BinaryAnnotationMappingDeriver.getInstance().mappingResult(binaryAnnotations);
    initUrl();/*  w  ww  . j a v  a  2s. co m*/
    initIpv4AndService();
}

From source file:com.evolveum.midpoint.prism.ComplexTypeDefinitionImpl.java

/**
 * Returns set of item definitions.//from   w w w . ja  v a 2 s . com
 * 
 * The set contains all item definitions of all types that were parsed.
 * Order of definitions is insignificant.
 * 
 * @return set of definitions
 */
@NotNull
@Override
public List<? extends ItemDefinition> getDefinitions() {
    return Collections.unmodifiableList(itemDefinitions);
}

From source file:net.hamnaberg.json.Query.java

static List<Query> fromArray(JsonNode queries) {
    return Collections.unmodifiableList(StreamSupport.stream(queries.spliterator(), false)
            .map(jsonNode -> new Query((ObjectNode) jsonNode)).collect(Collectors.toList()));
}

From source file:de.xirp.db.ChartDatabaseUtil.java

/**
 * Returns all {@link de.xirp.db.Observed} for the
 * given record, key name and time interval.
 * //from   ww w.  j  a v a 2 s  . c  om
 * @param record
 *            The record to look in.
 * @param keyname
 *            The name of the observed key.
 * @param startTime
 *            The start time of the time interval.
 * @param stopTime
 *            the stop tine of the time interval.
 * @return A list with all <code>Observed</code> for the record,
 *         key and time interval.
 * @see de.xirp.db.Observed
 */
@SuppressWarnings("unchecked")
public static List<Observed> getObservedList(Record record, String keyname, long startTime, long stopTime) {
    Session session = DatabaseManager.getCurrentHibernateSession();
    session.getTransaction().begin();

    Query query = session.createQuery(
            "FROM Observed as obs WHERE obs.record = ? and obs.observedKey = ? and obs.timestamp >= ? and obs.timestamp <= ?"); //$NON-NLS-1$
    query.setEntity(0, record);
    query.setString(1, keyname);
    query.setLong(2, startTime);
    query.setLong(3, stopTime);
    List<Observed> obs = query.list();

    session.close();
    return Collections.unmodifiableList(obs);
}

From source file:com.hp.octane.integrations.uft.items.UftTestDiscoveryResult.java

private List<ScmResourceFile> getResourceFilesByOctaneStatus(OctaneStatus status) {
    List<ScmResourceFile> filtered = new ArrayList<>();
    for (ScmResourceFile file : scmResourceFiles) {
        if (file.getOctaneStatus().equals(status)) {
            filtered.add(file);/*from w  w  w.j a v  a  2  s  .c  om*/
        }
    }
    return Collections.unmodifiableList(filtered);
}

From source file:edu.cmu.tetrad.calculator.expression.AbstractExpression.java

public AbstractExpression(String token, ExpressionDescriptor.Position position, Expression... expressions) {
    this.position = position;
    this.token = token;
    this.expressions = Collections.unmodifiableList(Arrays.asList(expressions));
}