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:Main.java

/**
 * Creates an unmodifiable shallow copy of the given original {@link List}. <p> While the copy returns an immutable
 * copy of the {@link List} the content is not cloned in any way. Unless the content is immutable by itself the
 * result is not fully immutable. In the shallow copy all references are the same as in the original {@link List}!
 * </p>//  w  w w  .  j  a  va  2 s.  c  o  m
 *
 * @param original The {@link List} to copy the elements fro.
 * @param <E>      The type of the elements
 *
 * @return Returns an immutable (unmodifiable) copy of the original {@link List} with all the elements added but not
 * cloned!
 */
public static <E> List<E> createUnmodifiableShallowCopy(final List<E> original) {
    if (original == null || original.isEmpty()) {
        return Collections.emptyList();
    } else {
        return Collections.unmodifiableList(new ArrayList<E>(original));
    }
}

From source file:com.pureinfo.srm.xls2srm.CSVObjectsImpl.java

public List toList() throws PureException {
    return Collections.unmodifiableList(m_datas);
}

From source file:test.parsing.CollectingReaderEventListener.java

public List<ImportDefinition> getImports() {
    return Collections.unmodifiableList(this.imports);
}

From source file:io.coala.example.conway.CellWorldLattice.java

@JsonIgnore
public synchronized List<Map<CellID, LifeState>> getInitialStates() throws CoalaException {
    final ModelID modelID = getID().getModelID();
    List<Map<CellID, LifeState>> result = INITIAL_STATES.get(modelID);
    if (result != null)
        return result;

    result = new ArrayList<Map<CellID, LifeState>>();
    INITIAL_STATES.put(modelID, Collections.unmodifiableList(result));

    final int[][] initialStates = getProperty("initialStates").getJSON(int[][].class);

    for (List<CellID> row : generateLatticeCellIDs(modelID, initialStates.length, initialStates[0].length)) {
        final Map<CellID, LifeState> rowStates = new HashMap<CellID, LifeState>();
        result.add(rowStates);/*from w  w  w  . j a va  2 s  .c om*/

        for (CellID cellID : row)
            rowStates.put(cellID,
                    initialStates[cellID.getRow()][cellID.getCol()] == 0 ? LifeState.DEAD : LifeState.ALIVE);
    }
    return result;
}

From source file:com.mirth.connect.plugins.httpauth.RequestInfo.java

public Map<String, List<String>> getHeaders() {
    Map<String, List<String>> headers = new CaseInsensitiveMap<String, List<String>>();
    for (Entry<String, List<String>> entry : this.headers.entrySet()) {
        headers.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
    }//  www .j a v a 2 s .  c  o m
    return Collections.unmodifiableMap(headers);
}

From source file:de.xirp.profile.ProfileManager.java

/**
 * Returns all incomplete/*w  w w  .  j  a v  a  2s  . c o  m*/
 * {@link de.xirp.profile.Profile profiles}.
 * 
 * @return A unmodifiable list with the incomplete profiles.
 * @see de.xirp.profile.Profile
 */
public static List<Profile> getIncompleteProfiles() {
    return Collections.unmodifiableList(incompleteProfiles);
}

From source file:net.daboross.bukkitdev.commandexecutorbase.SubCommand.java

public List<String> getArgumentNames() {
    return Collections.unmodifiableList(argumentNames);
}

From source file:net.dv8tion.jda.core.entities.impl.RoleImpl.java

@Override
public List<Permission> getPermissions() {
    return Collections.unmodifiableList(Permission.getPermissions(rawPermissions));
}

From source file:libepg.ts.fileseeker.TsFileSeeker.java

/**
 * ???????/*  w w  w. ja v a  2  s . c  o  m*/
 *
 * @return ??????
 */
public synchronized List<File> seek() {
    List<File> list = Collections.synchronizedList(new ArrayList<File>());
    Collection<File> files = FileUtils.listFiles(this.SourceDir, this.TS_SUFFIX, this.dirf);
    list.addAll(files);
    return Collections.unmodifiableList(list);
}

From source file:com.frank.search.solr.core.query.GroupOptions.java

/**
 * List of {@link Function}s to perform grouping by.
 * //from  w  ww . j av  a 2  s.c o m
 * @return
 */
public List<Function> getGroupByFunctions() {
    return Collections.unmodifiableList(groupByFunctions);
}