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.flowpowered.api.util.SyncedMapEvent.java

public SyncedMapEvent(SyncedStringMap map, Action action, List<Pair<Integer, String>> modifiedElements) {
    super(map);//from w  w  w  .  j a v  a2  s.com
    this.action = action;
    this.modifiedElements = Collections.unmodifiableList(modifiedElements);
}

From source file:io.bitsquare.util.spring.JOptCommandLinePropertySource.java

@Override
public List<String> getOptionValues(String name) {
    List<?> argValues = this.source.valuesOf(name);
    List<String> stringArgValues = new ArrayList<>();
    for (Object argValue : argValues) {
        stringArgValues.add(argValue instanceof String ? (String) argValue : argValue.toString());
    }/*from www  .  j  a v a 2  s  . c o  m*/
    if (stringArgValues.isEmpty()) {
        return (this.source.has(name) ? Collections.<String>emptyList() : null);
    }
    return Collections.unmodifiableList(stringArgValues);
}

From source file:ca.uhn.fhir.context.RuntimeChildChoiceDefinition.java

public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation,
        Description theDescriptionAnnotation, List<Class<? extends IBase>> theChoiceTypes) {
    super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);

    myChoiceTypes = Collections.unmodifiableList(theChoiceTypes);
}

From source file:com.thinkbiganalytics.metadata.modeshape.support.JcrPath.java

public JcrPath(boolean absolute, List<String> elements) {
    this.elements = Collections.unmodifiableList(elements);
    this.absolute = absolute;
}

From source file:net.e2.bw.servicereg.ldap.model.CachedServiceInstance.java

/** Constructor */
public CachedServiceInstance(String serviceInstanceId, String organizationId, String specificationId,
        String name, String summary, List<Area> coverage, List<ServiceEndpoint> endpoints,
        Map<String, List<String>> roleUserMap) {
    super.setServiceInstanceId(serviceInstanceId);
    super.setOrganizationId(organizationId);
    super.setSpecificationId(specificationId);
    super.setName(name);
    super.setSummary(summary);
    super.setCoverage(Collections.unmodifiableList(coverage != null ? coverage : new ArrayList<>()));
    super.setEndpoints(Collections.unmodifiableList(endpoints != null ? endpoints : new ArrayList<>()));
    this.roleUserMap = Collections.unmodifiableMap(roleUserMap != null ? roleUserMap : new HashMap<>());
    // NB: Actually, each element of the roleUserMap should be made unmodifiable...
}

From source file:edu.wustl.cab2b.server.path.pathgen.Path.java

Path(Node fromNode, Node toNode, List<Node> intermediateNodes) {
    this.sdp = new SourceDestinationPair(fromNode, toNode);
    if (intermediateNodes == null) {
        this.intermediateNodes = Collections.unmodifiableList(new ArrayList<Node>(0));
    } else {// w w  w  .  j  a v a2 s  . c o  m
        this.intermediateNodes = Collections.unmodifiableList(intermediateNodes);
    }
}

From source file:com.aqnote.app.wifianalyzer.wifi.band.WiFiChannelsGHZ5.java

@Override
public List<Pair<WiFiChannel, WiFiChannel>> getWiFiChannelPairs() {
    return Collections.unmodifiableList(SETS);
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.developer.loggers.StackTraceUtility.java

private List<StackTraceElement> loadStackTrace() {
    StackTraceElement[] stack = Thread.currentThread().getStackTrace();
    List<StackTraceElement> list = new ArrayList<StackTraceElement>(Arrays.asList(stack));

    trimStackTraceAtBeginning(list);// w  w  w.ja va  2 s. co  m
    trimStackTraceAtEnd(list);
    removeJenaClassesFromStackTrace(list);

    log.debug("Stack array: " + Arrays.toString(stack));
    log.debug("Stack trace: " + list);
    return Collections.unmodifiableList(list);
}

From source file:com.trenako.utility.Utils.java

/**
 * Creates an immutable {@code ArrayList} with the first elements.
 *
 * @param elements the elements//from   w  w w  . j  a v a2 s  .  c o m
 * @param size     the size of the new sublist
 * @return the {@code ArrayList}
 */
public static <E> List<E> newSublist(Iterable<E> elements, int size) {
    Assert.isTrue(size > 0, "Size must be > 0");

    int i = 1;
    List<E> list = new ArrayList<>();
    for (E el : elements) {
        list.add(el);
        if (i == size) {
            break;
        }
        i++;
    }
    return Collections.unmodifiableList(list);
}

From source file:com.arpnetworking.metrics.proxy.models.messages.LogLine.java

@JsonIgnore
public List<Byte> getLine() {
    return Collections.unmodifiableList(Bytes.asList(_line));
}