当前位置: 首页>>代码示例>>Java>>正文


Java Collections.unmodifiableList方法代码示例

本文整理汇总了Java中java.util.Collections.unmodifiableList方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.unmodifiableList方法的具体用法?Java Collections.unmodifiableList怎么用?Java Collections.unmodifiableList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Collections的用法示例。


在下文中一共展示了Collections.unmodifiableList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkChoices

import java.util.Collections; //导入方法依赖的package包/类
protected Object[] checkChoices(Iterable<T> validChoices, T[] defValueCandidates) {
	List<T> lst = new ArrayList<T>();
	for (T t : validChoices)
		lst.add(t);
	T defaultValue = null;
	for (T defVal : defValueCandidates) {
		if (lst.contains(defVal)) {
			defaultValue = defVal;
			break;
		}
	}
	if (defaultValue == null) {
		defaultValue = lst.get(0);
	}
	return new Object[] {
			Collections.unmodifiableList(lst), defaultValue
	};
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:A4Preferences.java

示例2: getAcceptableMediaTypes

import java.util.Collections; //导入方法依赖的package包/类
public static List<MediaType> getAcceptableMediaTypes(Request request)
{
	// See: http://docs.oracle.com/javaee/7/api/javax/ws/rs/core/HttpHeaders.html#getAcceptableMediaTypes--
	HttpServletRequest rawReq = request.raw();
	List<String> values = Collections.list(rawReq.getHeaders("Accept"));
	if (values.isEmpty()) {
		return Collections.singletonList(MediaType.WILDCARD_TYPE);
	}
	ArrayList<MediaType> acceptable = new ArrayList();
	for (String value : values) {
		for (String type : StringUtils.split(value, ',')) {
			acceptable.add(MediaType.valueOf(type.trim()));
		}
	}
	MediaTypeHelper.sortByWeight(acceptable);
	return Collections.unmodifiableList(acceptable);
}
 
开发者ID:RSNA,项目名称:dcmrs-broker,代码行数:18,代码来源:HttpUtil.java

示例3: getOrderedChildren

import java.util.Collections; //导入方法依赖的package包/类
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

    if (super.getOrderedChildren() != null) {
        children.addAll(super.getOrderedChildren());
    }

    if (nameID != null) {
        children.add(nameID);
    }
    
    if (encryptedID != null) {
        children.add(encryptedID);
    }

    if (children.size() == 0) {
        return null;
    }

    return Collections.unmodifiableList(children);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:NameIDMappingResponseImpl.java

示例4: Federation

import java.util.Collections; //导入方法依赖的package包/类
public Federation(List<BtcECKey> publicKeys, Instant creationTime, long creationBlockNumber,  NetworkParameters btcParams) {
    // Sorting public keys ensures same order of federators for same public keys
    // Immutability provides protection unless unwanted modification, thus making the Federation instance
    // effectively immutable
    this.publicKeys = Collections.unmodifiableList(publicKeys.stream().sorted(BtcECKey.PUBKEY_COMPARATOR).collect(Collectors.toList()));
    // using this.publicKeys ensures order in rskPublicKeys
    this.rskPublicKeys = Collections.unmodifiableList(this.publicKeys.stream()
            .map(BtcECKey::getPubKey)
            .map(ECKey::fromPublicOnly)
            .collect(Collectors.toList()));
    this.creationTime = creationTime;
    this.creationBlockNumber = creationBlockNumber;
    this.btcParams = btcParams;
    // Calculated once on-demand
    this.redeemScript = null;
    this.p2shScript = null;
    this.address = null;
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:19,代码来源:Federation.java

示例5: getExtensibleTargets

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Get a list of target names in the main build script that are allowed to be 
 * extended by adding the "depends" attribute definition to them.
 * @return list of target names
 */
public List<String> getExtensibleTargets() {
    List<String> targets = new ArrayList<String>();
    targets.addAll(implementation.getExtensibleTargets());
    targets = Collections.unmodifiableList(targets);
    return targets;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:AntBuildExtender.java

示例6: initialize

import java.util.Collections; //导入方法依赖的package包/类
protected void initialize(Map<String, T> entryMap, Opcodes opcodes) {
	if (entryMap == null) throw new NullPointerException("entryMap");
	if (this.entryMap != null) throw new IllegalStateException("Already initialized");
	this.entryMap = entryMap;
	// See: https://github.com/JesusFreke/smali/issues/458
	entryNames = Collections.unmodifiableList(new ArrayList<>(entryMap.keySet()));
	if (opcodes == null) {
		//opcodes = getNewestOpcodes();
		for (T entry : entryMap.values()) {
			opcodes = OpcodeUtils.getNewestOpcodesNullable(opcodes, entry.getOpcodes());
		}
		//if (opcodes == null) throw nullOpcodes();
	}
	resolvedOpcodes = opcodes;
}
 
开发者ID:DexPatcher,项目名称:multidexlib2,代码行数:16,代码来源:AbstractMultiDexContainer.java

示例7: Examples

import java.util.Collections; //导入方法依赖的package包/类
public Examples(Location location, List<Tag> tags, String keyword, String name, String description, TableRow tableHeader, List<TableRow> tableBody) {
    super(location);
    this.tags = Collections.unmodifiableList(tags);
    this.keyword = keyword;
    this.name = name;
    this.description = description;
    this.tableHeader = tableHeader;
    this.tableBody = tableBody != null ? Collections.unmodifiableList(tableBody) : null;
}
 
开发者ID:andrewjc,项目名称:kheera-testrunner-android,代码行数:10,代码来源:Examples.java

示例8: add

import java.util.Collections; //导入方法依赖的package包/类
public BlobPath add(String path) {
    List<String> paths = new ArrayList<>();
    paths.addAll(this.paths);
    paths.add(path);
    return new BlobPath(Collections.unmodifiableList(paths));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:BlobPath.java

示例9: DirList3

import java.util.Collections; //导入方法依赖的package包/类
public DirList3(Entry3[] entries, boolean eof) {
  this.entries = Collections.unmodifiableList(Arrays.asList(entries));
  this.eof = eof;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:READDIR3Response.java

示例10: getExamples

import java.util.Collections; //导入方法依赖的package包/类
public List<ExampleProcess> getExamples() {
	return Collections.unmodifiableList(exampleProcesses);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:4,代码来源:OperatorDocumentation.java

示例11: MultiResponse

import java.util.Collections; //导入方法依赖的package包/类
MultiResponse(List<Response> responses) {
    this.responses = Collections.unmodifiableList(responses);
}
 
开发者ID:pCloud,项目名称:pcloud-networking-java,代码行数:4,代码来源:MultiResponse.java

示例12: getIntermediateMimetypes

import java.util.Collections; //导入方法依赖的package包/类
public List<String> getIntermediateMimetypes()
{
   return Collections.unmodifiableList(intermediateMimetypes);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:ComplexContentTransformer.java

示例13: getSubtypes

import java.util.Collections; //导入方法依赖的package包/类
public List<ItemType> getSubtypes() {
  return Collections.unmodifiableList(items);
}
 
开发者ID:salesforce,项目名称:AptSpring,代码行数:4,代码来源:ItemType.java

示例14: getChildren

import java.util.Collections; //导入方法依赖的package包/类
@Override
public List<TransformationUtility> getChildren() {
    return Collections.unmodifiableList(childrenList);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:5,代码来源:TransformationUtilityLoop.java

示例15: getMessages

import java.util.Collections; //导入方法依赖的package包/类
public List<MessageEntry> getMessages() {
    return Collections.unmodifiableList(messages);
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:4,代码来源:CustomMessageEntry.java


注:本文中的java.util.Collections.unmodifiableList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。