當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。