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


Java Collections.checkedList方法代码示例

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


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

示例1: DOMXMLSignature

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Creates a <code>DOMXMLSignature</code> from the specified components.
 *
 * @param si the <code>SignedInfo</code>
 * @param ki the <code>KeyInfo</code>, or <code>null</code> if not specified
 * @param objs a list of <code>XMLObject</code>s or <code>null</code>
 *  if not specified. The list is copied to protect against subsequent
 *  modification.
 * @param id an optional id (specify <code>null</code> to omit)
 * @param signatureValueId an optional id (specify <code>null</code> to
 *  omit)
 * @throws NullPointerException if <code>si</code> is <code>null</code>
 */
public DOMXMLSignature(SignedInfo si, KeyInfo ki,
                       List<? extends XMLObject> objs,
                       String id, String signatureValueId)
{
    if (si == null) {
        throw new NullPointerException("signedInfo cannot be null");
    }
    this.si = si;
    this.id = id;
    this.sv = new DOMSignatureValue(signatureValueId);
    List<XMLObject> tempList =
        Collections.checkedList(new ArrayList<XMLObject>(),
                                XMLObject.class);
    if (objs != null) {
        tempList.addAll(objs);
    }
    this.objects = Collections.unmodifiableList(tempList);
    this.ki = ki;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:DOMXMLSignature.java

示例2: unresizable

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Lists that don't allow resizing, but allow setting values
 */
@DataProvider
public static Object[][] unresizable() {
    final List<Integer> c1 = Arrays.asList(42);
    final List<Integer> c9 = Arrays.asList(40, 41, 42, 43, 44, 45, -1,
            Integer.MIN_VALUE, 1000500);

    Object[][] l1 = unsettable();
    Object[][] l2 = {
        {c1, 0, 1},
        {c1.subList(0, 1), 0, 1},
        {Collections.checkedList(c1, Integer.class), 0, 1},
        {Collections.synchronizedList(c1), 0, 1},
        {c9, 0, 4},
        {c9, 4, 6},
        {c9.subList(1, 8), 1, 4},
        {c9.subList(1, 8), 0, 7},
        {Collections.checkedList(c9, Integer.class), 3, 6},
        {Collections.synchronizedList(c9), 3, 5},
    };
    Object[][] res = Arrays.copyOf(l1, l1.length + l2.length);
    System.arraycopy(l2, 0, res, l1.length, l2.length);
    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:SubList.java

示例3: XPathFilter2ParameterSpec

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Creates an <code>XPathFilter2ParameterSpec</code>.
 *
 * @param xPathList a list of one or more {@link XPathType} objects. The
 *    list is defensively copied to protect against subsequent modification.
 * @throws ClassCastException if <code>xPathList</code> contains any
 *    entries that are not of type {@link XPathType}
 * @throws IllegalArgumentException if <code>xPathList</code> is empty
 * @throws NullPointerException if <code>xPathList</code> is
 *    <code>null</code>
 */
public XPathFilter2ParameterSpec(List<XPathType> xPathList) {
    if (xPathList == null) {
        throw new NullPointerException("xPathList cannot be null");
    }
    List<XPathType> tempList =
        Collections.checkedList(new ArrayList<XPathType>(),
                                XPathType.class);
    tempList.addAll(xPathList);
    if (tempList.isEmpty()) {
        throw new IllegalArgumentException("xPathList cannot be empty");
    }
    this.xPathList = Collections.unmodifiableList(tempList);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:XPathFilter2ParameterSpec.java

示例4: modifiable

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Lists that allow any modifications: resizing and setting values
 */
@DataProvider
public static Object[][] modifiable() {
    final List<Integer> c1 = Arrays.asList(42);
    final List<Integer> c9 = Arrays.asList(40, 41, 42, 43, 44, 45, -1,
            Integer.MIN_VALUE, 1000500);

    return new Object[][] {
        {new ArrayList<>(c1), 0, 1},
        {new LinkedList<>(c1), 0, 1},
        {new Vector<>(c1), 0, 1},
        {new ArrayList<>(c1).subList(0, 1), 0, 1},
        {new LinkedList<>(c1).subList(0, 1), 0, 1},
        {new Vector<>(c1).subList(0, 1), 0, 1},
        {Collections.checkedList(new ArrayList<>(c1), Integer.class), 0, 1},
        {Collections.checkedList(new LinkedList<>(c1), Integer.class), 0, 1},
        {Collections.checkedList(new Vector<>(c1), Integer.class), 0, 1},
        {Collections.synchronizedList(new ArrayList<>(c1)), 0, 1},
        {Collections.synchronizedList(new LinkedList<>(c1)), 0, 1},
        {Collections.synchronizedList(new Vector<>(c1)), 0, 1},

        {new ArrayList<>(c9), 2, 5},
        {new LinkedList<>(c9), 2, 5},
        {new Vector<>(c9), 2, 5},
        {new ArrayList<>(c9).subList(1, 8), 1, 4},
        {new LinkedList<>(c9).subList(1, 8), 1, 4},
        {new Vector<>(c9).subList(1, 8), 1, 4},
        {Collections.checkedList(new ArrayList<>(c9), Integer.class), 2, 5},
        {Collections.checkedList(new LinkedList<>(c9), Integer.class), 2, 5},
        {Collections.checkedList(new Vector<>(c9), Integer.class), 2, 5},
        {Collections.synchronizedList(new ArrayList<>(c9)), 2, 5},
        {Collections.synchronizedList(new LinkedList<>(c9)), 2, 5},
        {Collections.synchronizedList(new Vector<>(c9)), 2, 5},
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:SubList.java

示例5: lists

import java.util.Collections; //导入方法依赖的package包/类
@DataProvider
public static Object[][] lists() {
    final boolean MODIFIABLE = true;
    final boolean NON_MODIFIABLE = false;
    List<Integer> c = Arrays.asList(42);

    return new Object[][] {
        {c, NON_MODIFIABLE},
        {new ArrayList<>(c), MODIFIABLE},
        {new LinkedList<>(c), MODIFIABLE},
        {new MyList(), NON_MODIFIABLE},
        {new Vector<>(c), MODIFIABLE},
        {Collections.singletonList(42), NON_MODIFIABLE},
        {Collections.checkedList(c, Integer.class), NON_MODIFIABLE},
        {Collections.checkedList(new ArrayList<>(c), Integer.class), MODIFIABLE},
        {Collections.checkedList(new LinkedList<>(c), Integer.class), MODIFIABLE},
        {Collections.checkedList(new Vector<>(c), Integer.class), MODIFIABLE},
        {Collections.synchronizedList(c), NON_MODIFIABLE},
        {Collections.synchronizedList(new ArrayList<>(c)), MODIFIABLE},
        {Collections.synchronizedList(new LinkedList<>(c)), MODIFIABLE},
        {Collections.synchronizedList(new Vector<>(c)), MODIFIABLE},
        {Collections.unmodifiableList(c), NON_MODIFIABLE},
        {Collections.unmodifiableList(new ArrayList<>(c)), NON_MODIFIABLE},
        {Collections.unmodifiableList(new LinkedList<>(c)), NON_MODIFIABLE},
        {Collections.unmodifiableList(new Vector<>(c)), NON_MODIFIABLE},
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:NestedSubList.java

示例6: testEvents

import java.util.Collections; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static List<TestEvent> testEvents(List<? extends Event> events) {
  return Collections.checkedList((List) events, TestEvent.class);
}
 
开发者ID:firebase,项目名称:firebase-admin-java,代码行数:5,代码来源:SyncPointTest.java

示例7: AttachmentList

import java.util.Collections; //导入方法依赖的package包/类
public AttachmentList(final int initialCapacity, final Class<T> valueClass) {
    delegate = Collections.checkedList(new ArrayList<T>(initialCapacity), valueClass);
    this.valueClass = valueClass;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AttachmentList.java

示例8: getObject

import java.util.Collections; //导入方法依赖的package包/类
protected List<String> getObject() {
    List<String> list = Collections.singletonList("string");
    return Collections.checkedList(list, String.class);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:java_util_Collections_CheckedList.java

示例9: getAnotherObject

import java.util.Collections; //导入方法依赖的package包/类
protected List<String> getAnotherObject() {
    List<String> list = Collections.emptyList();
    return Collections.checkedList(list, String.class);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:java_util_Collections_CheckedList.java

示例10: getObject

import java.util.Collections; //导入方法依赖的package包/类
protected List<String> getObject() {
    List<String> list = new ArrayList<String>();
    list.add("string");
    return Collections.checkedList(list, String.class);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:java_util_Collections_CheckedRandomAccessList.java

示例11: getAnotherObject

import java.util.Collections; //导入方法依赖的package包/类
protected List<String> getAnotherObject() {
    List<String> list = new ArrayList<String>();
    return Collections.checkedList(list, String.class);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:java_util_Collections_CheckedRandomAccessList.java

示例12: ExcC14NParameterSpec

import java.util.Collections; //导入方法依赖的package包/类
/**
 * Creates a <code>ExcC14NParameterSpec</code> with the specified list
 * of prefixes. The list is copied to protect against subsequent
 * modification.
 *
 * @param prefixList the inclusive namespace prefix list. Each entry in
 *    the list is a <code>String</code> that represents a namespace prefix.
 * @throws NullPointerException if <code>prefixList</code> is
 *    <code>null</code>
 * @throws ClassCastException if any of the entries in the list are not
 *    of type <code>String</code>
 */
public ExcC14NParameterSpec(List<String> prefixList) {
    if (prefixList == null) {
        throw new NullPointerException("prefixList cannot be null");
    }
    List<String> tempList = Collections.checkedList(new ArrayList<>(),
                                                    String.class);
    tempList.addAll(prefixList);
    this.prefixList = Collections.unmodifiableList(tempList);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:ExcC14NParameterSpec.java


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