src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/util/ObjectListImpl.java
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
equal deleted inserted replaced
47358:d07d5f7cab35 47359:e1a6c0168741
     1 /*
     1 /*
     2  * reserved comment block
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT REMOVE OR ALTER!
     3  * @LastModified: Oct 2017
     4  */
     4  */
     5 /*
     5 /*
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     7  * contributor license agreements.  See the NOTICE file distributed with
     7  * contributor license agreements.  See the NOTICE file distributed with
     8  * this work for additional information regarding copyright ownership.
     8  * this work for additional information regarding copyright ownership.
    19  * limitations under the License.
    19  * limitations under the License.
    20  */
    20  */
    21 
    21 
    22 package com.sun.org.apache.xerces.internal.impl.xs.util;
    22 package com.sun.org.apache.xerces.internal.impl.xs.util;
    23 
    23 
       
    24 import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
    24 import java.lang.reflect.Array;
    25 import java.lang.reflect.Array;
    25 import java.util.AbstractList;
    26 import java.util.AbstractList;
    26 
       
    27 import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
       
    28 
    27 
    29 /**
    28 /**
    30  * Contains a list of Objects.
    29  * Contains a list of Objects.
    31  *
    30  *
    32  * @xerces.internal
    31  * @xerces.internal
    33  *
    32  *
    34  */
    33  */
    35 public final class ObjectListImpl extends AbstractList implements ObjectList {
    34 @SuppressWarnings("unchecked") // method <T>toArray(T[])
       
    35 public final class ObjectListImpl extends AbstractList<Object> implements ObjectList {
    36 
    36 
    37     /**
    37     /**
    38      * An immutable empty list.
    38      * An immutable empty list.
    39      */
    39      */
    40     public static final ObjectListImpl EMPTY_LIST = new ObjectListImpl(new Object[0], 0);
    40     public static final ObjectListImpl EMPTY_LIST = new ObjectListImpl(new Object[0], 0);
    97         return a;
    97         return a;
    98     }
    98     }
    99 
    99 
   100     public Object[] toArray(Object[] a) {
   100     public Object[] toArray(Object[] a) {
   101         if (a.length < fLength) {
   101         if (a.length < fLength) {
   102             Class arrayClass = a.getClass();
   102             Class<?> arrayClass = a.getClass();
   103             Class componentType = arrayClass.getComponentType();
   103             Class<?> componentType = arrayClass.getComponentType();
   104             a = (Object[]) Array.newInstance(componentType, fLength);
   104             a = (Object[]) Array.newInstance(componentType, fLength);
   105         }
   105         }
   106         toArray0(a);
   106         toArray0(a);
   107         if (a.length > fLength) {
   107         if (a.length > fLength) {
   108             a[fLength] = null;
   108             a[fLength] = null;