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:com.github.jknack.css.expression.ExpressionList.java

public List<Expression> expressions() {
    return Collections.unmodifiableList(expressions);
}

From source file:com.create.validation.ValidationErrorsProvider.java

public ValidationErrorsProvider(List<?> targets, List<ObjectError> objectErrors) {
    this.targets = Collections.unmodifiableList(targets);
    this.propertyValidationErrorsProvider = new PropertyValidationErrorsProvider(objectErrors);
}

From source file:com.ok2c.lightmtp.SMTPCommand.java

public SMTPCommand(final String code, final String argument, final List<String> params) {
    super();/*ww  w .j av a  2  s.  c  o m*/
    Args.notNull(code, "Code");
    this.verb = code;
    this.argument = argument;
    if (params == null || params.isEmpty()) {
        this.params = Collections.emptyList();
    } else {
        this.params = Collections.unmodifiableList(new ArrayList<String>(params));
    }
}

From source file:Main.java

/**
 * Wrap a {@link java.util.Collection} in an unmodifiable {@link java.util.List}.
 * If the collection is already a {@link java.util.List} then it is cast, otherwise
 * its elements are copied into a new {@link java.util.List}.
 *
 * @param collection  The collection to wrap.
 *
 * @param <E>  The collection element type.
 *//*from w  w w. j a va 2  s  . co m*/
public static <E> List<E> unmodifiableList(Collection<E> collection) {
    return collection instanceof List ? Collections.unmodifiableList((List<E>) collection)
            : Collections.unmodifiableList(new ArrayList<E>(collection));
}

From source file:edu.wisc.my.stats.domain.TimeResolution.java

private TimeResolution(int minutes, int... calendarFields) {
    this.minutes = minutes;

    final List<Integer> fields = new ArrayList<Integer>(calendarFields.length);
    for (final int field : calendarFields) {
        fields.add(field);/*w  w w.  j ava  2  s.  co m*/
    }

    this.calendarFields = Collections.unmodifiableList(fields);
}

From source file:com.yoncabt.ebr.executor.ReportList.java

public List<ReportTask> get() {
    return Collections.unmodifiableList(requestList);
}

From source file:com.buffalokiwi.aerodrome.jet.JetException.java

/**
 * Creates a new instance of <code>JetException</code> without detail message.
 *//*w w w .j  av  a 2  s .c  o  m*/
public JetException() {
    response = null;
    messages = Collections.unmodifiableList(new ArrayList<String>());
}

From source file:com.netflix.spinnaker.clouddriver.artifacts.ArtifactCredentialsRepository.java

public ArtifactCredentialsRepository(List<List<? extends ArtifactCredentials>> allCredentials) {
    this.allCredentials = Collections.unmodifiableList(allCredentials.stream().filter(Objects::nonNull)
            .flatMap(Collection::stream).collect(Collectors.toList()));
}

From source file:Main.java

public static <T> List<T> unmodifiableList(final List<? extends T> l, final boolean newList,
        final boolean emptyAsNull) {
    if (l == null) {
        return null;
    }/*from   ww w . j  av  a2 s .c om*/

    if (emptyAsNull && l.isEmpty()) {
        return null;
    }

    return Collections.unmodifiableList(newList ? new ArrayList<>(l) : l);
}

From source file:at.ac.tuwien.dsg.cloud.utilities.messaging.lightweight.rabbitMq.TypeHandler.java

public List<String> getTypes() {
    return Collections.unmodifiableList(this.types);
}