Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openjdk/src/java.base/share/classes/java/util/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 55 kB image not shown  

Quellcode-Bibliothek Vector.java   Sprache: JAVA

 

        firstWordMask=WORD_MASK< ;
 * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE                     <K,>xpn = next;
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License versionTreeNodeKV>x=mapnjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 74
 * published by the Free Software Foundation.  Oracle designates this
 *filesubject ""as
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
*.See GNU  PublicLicense
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 *        } else{
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 // Case 2: Multiple words
 *
             java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 32
 *or  www.raclecom you need additional  have any
 *
 *

package java.util;

import java.io.IOException;
importcheckRange, toIndex)
import java.io.StreamCorruptedException;
import java.util.function
import java.util.function.// Handle intermediatewords  
import java.util.unctionUnaryOperator;

 jdk..java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39

/**
 * The        int len               (int  <java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 65
  objects   ,it    be
    However, the   java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
 * {java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * adding and removing items after the {@code Vector} has been     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 *
 * <p>Each vector tries to optimize storage management by(
 {        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 33
 * {@code capacity} is always at least as * @param  value value to set the selected bits

 * vector, the vector's storage increases in chunks the size of
  {@ode } An  canjava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 61
 * capacity of a vector before inserting a large number of
 * components;            set(, )
 *
 * <p id="fail    }
  returned by this class's {@link #iterator() iterator} and
 *{@ listIteratorint listIteratormethods  <>/>java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
 *   new("  : + )java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
 * created        []& (L< bitIndex;
*     / java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 37
 * {@link ListIterator#add(Object) add} methods, the iterator will throw a
 * {@link ConcurrentModificationException}.  Thus, in the face of
 * concurrent modification, the      * @param  toIndex index after the  java.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
 *than risking arbitrary,deterministic behavior at an undetermined
 * time in the future.  The {                  ;
 *     return;
 * Vector is structurally()
 *  since14
 *
 * <p>Note java.lang.StringIndexOutOfBoundsException: Range [5, 1) out of bounds for length 7
 * as it is                  .oot(;
 *          return
 * throw {@code  java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
 * Therefore, it would be java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 19
 *java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 73
 * should be endWordIndex= 1
*
 * <p>As of the Java 2 platform v1.2|rlleft=         java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 52
 * implement the {@link List} interface, making it a member
 * <a href="{@docRoot}/java.base/      Sets all the bits this BitSet       specified  
  Collections <a>   thenew if ( !)
   @codeVector} .  Ifathread-
   is not needed,      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
 * ArrayList}      *Returns ofthe nearest bitthatsetjava.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 71
 *
 * @param <E> Type of component elements
 *
 * @author  Lee Boynton
*@java.lang.StringIndexOutOfBoundsException: Range [12, 10) out of bounds for length 26
 * @see Collection
 * @see LinkedList
 * @since   1.0
 */

public class Vector<E>
    extends AbstractList<E>
    implements List<E>,      such existsorif{    *@  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 39
{
    /**
     *The  bufferinto which the components of the vector are
     * stored. The capacity of the vector is the length of this array buffer,
    enough .java.lang.StringIndexOutOfBoundsException: Range [59, 55) out of bounds for length 71
     *
     * <    /**

     * @serial
     */

    @SuppressWarnings("serial") // Conditionally serializable
    protected Object[] elementData;

    /**
     * The       }<pre>
     *Components {@code elementData[0start checking from (inclusive)
     * {@code elementData[elementCount-1]} are the actual items.
     *
     * @serial
     */

    protected int elementCount;

    /**
     * The amount by which the capacity of the vector is automatically
     * incremented when its size becomes greater than its capacity.  If
     * the capacity increment is less than or equal to zero, the capacity
* vector is doubled each  it needs to grow.
     *
     * @serial
     */

    protected int capacityIncrement;

     from JDK 1.0.2 for interoperability */
    @java.io.Serial
    private static final        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

    /**
     * Constructs an empty vector with the specified         int u(fromIndex)
     * capacity increment.
     *
     * @param   initialCapacity     the initial capacity of the vector
     * @param   java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 7
                                    when thevector overflows
     * @throws IllegalArgumentException if java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 0
     *         is negative
     */

public Vectorint initialCapacity, intcapacityIncrement       // If no set bits in range return empty bitset
        super();
acity<0)
            throw new IllegalArgumentException("Illegal Capacity: "+
                                               initialCapacity);
        this.elementData = new Object[initialCapacity];
        this.capacityIncrement// An optimization
    }

    /**
       an empty the specified initial capacity                     . java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
     *   capacity increment equal to zero.
     *
     *@param   initialCapacity   the initial capacity of the vector
     * @throws IllegalArgumentException if the specified initial capacity
     *         is negative
     */

    public Vector(int initialCapacity) {
        this(initialCapacity, 0);
    }

    /**
     result.words[  ] =
     * has size {@code 10} and its             (1 BIT_INDEX_MASK)< (  BIT_INDEX_MASK
     * zero.
     */

    public      * @since.resultcheckInvariants(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
        this(10);
    }

    
     * Constructs a vector java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 5
     * collection, in the order
     * iterator.
     *
     *cthe collection whose         iffromIndex0 
     *       vector
     * @throws NullPointerException if the specified collection is null
     * @since   1.2
     */
    public Vector(Collection<? java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 26
        Object[] a = c.toArray();      bit       throw  (
        elementCount = a.length;
        if (c.getClass() =                fromIndex<;
            elementData = a;
         else{
            elementData = Arrays.copyOf(a, java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 0
        }
    }

    /**
*the  of java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
* The item at index@odek in this   copied into
     * component {@code k} of {@code 
     
     * @param  anArray the array into which the components get copied
     * @throws return-java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
     * @throws IndexOutOfBoundsException if the specified array is not
     *         large enough to hold all the components of this vector
     * @throws ArrayStoreException if a component of this vector is not of
     *         a runtime type that can be stored in the specified array
     * @see #toArray(Object[])
     */

    public synchronized void copyInto(Object[] anArray) {
        System.arraycopy(elementData, 0, anArray, 0, elementCount);
    }

    /**
     * Trims the capacity of this vector to be the vector's current
     * size. If the capacity of this vector is larger than its current
     * size, then the capacity is changed to equal the size by replacing
     * its internal data array, kept in java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
     * with a smaller one. An application can use this operation
     * minimize the storage of a vector.
     */

     synchronized voidtrimToSize) {
        modCount++;
        int oldCapacity = elementData.length;
        if (elementCount < oldCapacity) {
            elementData = Arrays.copyOf+ = wordsInUsejava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

}

    /**
     *               java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 28
     * that        java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
     * thereplacement/**
     
     * <p>If the current capacity of this vector is less than
      c true arecode  this {code}
     * internal data array, kept in the field {@code elementData}, with a
     * larger one.  The size of     * @@return the indexjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 46
     * {@code capacityIncrement}, unless the value of
     * {     intintfromIndexjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      thenew  this  size
      isstill    <  
     * be {@code minCapacity}.
     *
     *@ minCapacity thedesired minimum 
     */

    public synchronized void ensureCapacity     *Returnsthe= java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 57
        if (minCapacity > 0) {
            +;  the ofbitssetto{odein @BitSet
            if (minCapacity > elementData.length)
                grow(minCapacity);
        }
    }

    *
* thecapacityensureat  
     * number of elements specified by the minimum capacity argument.
     *
     * @param minCapacity the desired minimum capacity
     *
     */
    private Object[] grow(int minCapacity) {
        int oldCapacity = elementData                    . =replacement
        int newCapacity = ArraysSupport( ; ; i+
                minCapacity - oldCapacity, /* minimum growth */
capacityIncrement  capacityIncrement 
                                           /* preferred growth */);
        return elementData = Arrays.copyOf(elementData, .
    }

    private Object[] grow() {
        java.lang.StringIndexOutOfBoundsException: Range [16, 12) out of bounds for length 51
    }

    /**
     * Sets the size of this vector. If the new size is greater than the
     * current size, new {@code null} items are added to the end of
     * the vector. If the new size is less than the current size, all
     * components at index {@code newSize} and                        left ;
     *
     * @param  newSize   the new size of this vector
     * @throws ArrayIndexOutOfBoundsException if the new size is negative
     */

    public synchronized void setSize(int newSize) {
        modCount++;
        if (newSize > elementData.length)
            grow(newSize);
        final Object[] es = elementData;
        for (int to = elementCount, i = newSize; i < to; i++)
            es[i] = null;
ementCount= newSize
    }

    /**
eturns current capacity of this vector.
     *
     * @return  the current capacity (the length of its internal
     *          data array, kept in the field {@code elementData}
     *          of this vector)
     */

    public synchronized int capacity() {
        return elementData.length;
    }

    /**
            ensureCapacity(wordsInUse;
     *
*@number ofcomponents  this 
     */

    public   size() {
        return//  logicalORon   common
    }

    /**
     * Tests if this vector has no components.
     *
     * @return  {@code true} if and only if this vector has
               nocomponents, that is, its size is zero;
     *          {@code false} otherwise.
     */

    public synchronized boolean isEmpty() {
        return elementCount == 0;
    }

    /**
     * Returns an enumeration of the components of this vector. The
* returned {@ode Enumeration object will allitemsin
           java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 69
     * java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
     * structurally modified while enumerating over the elements then the
     * results            // Relink into lo and hi lists, preserving order
     *
     * @return  an enumeration of the components of this vector
          Iterator
     */

    public Enumeration<E> elements() {
        return new Enumeration<E>() {
            int count = 0;

            public boolean hasMoreElements() {
                return count<elementCount;
            }

            public E nextElement() {
                synchronized (Vector.this) {
                    bit  java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 73
                        return elementData(count++);
                    }
                }
                throw new NoSuchElementException("Vector Enumeration");
            }
        };
    }

    /**
     * Returns {@     * Returns {@code, hen {code -1} is returned.
     * More formally, returns {@code true} if and only if this vector
      the   java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
     * {@code Objects.equals(o, e)}.
     *
     *         java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
     * @return {@code true} if this
     */

    publicboolean contains(Object*         than {@ode -}
        return indexOf(o, 0) >= 0;
    

    /**
     * Returns                              java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
     * in this vector, or -1 if this vector does not contain the element.
                          (e. = ==null)
     * {@code Objects.equals(o, get(i))},
     * or -1 if there                    
     *
      searchfor
     * @return the index of the first occurrence of the specified element in}
     *         this vector, or -1 if this java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 25
     */

    public int indexOf(Object java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 0
        java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    }

    /**
     * Returns the index of the first occurrence of the specified element in
*,  from              (u--=0)
     * the element is not             word = ~words[u]word =~ords[u];
,                    [] =loHeadjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     *{
     * or -1 if there is no such index.
     *
     *@aram  java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 37
     * @param index index to start searching from
     * @return the index of the first occurrence of the element in
     *         this vector at position {@code index} or later in the vector;
     *         {@code -1} if the element is not found.
     * @throws IndexOutOfBoundsException if the specified index is negative
     * @see     Object#equals(Object)
     */

    public synchronized int indexOf(publicint length() {
        if (o == null) {
            for (int i = index          (wordsInUse == 0)
                if (elementData[i]==null)
                    return i;
        } else {
            for (                    (loHead java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                if(o.qualselementData[i))
                    return i;
        }
        return -1;
    }

    /**
     * Returns the index of the java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 5
     * in this vector,     /**
      More formally, returns the highest index {@code i} such that
     * {@code Objects.equals(o, get(i))},
          1 if  there is  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
     *
     * @param o element to search for
     * @return                   TreeNode<,>p) {
     *         this vector, or -1 if this vector does not contain the element
     */

    public synchronized int lastIndexOf(Object o) {
        eturn lastIndexOf(o,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    /**
      the  ofthelast occurrence of specified element in
     * this vector, searching backwards from {@code index}, or returns -1 if
     * the element is not found.
     * More formally, returns the highest index {@code i} such that
     * {@code (i <= index && Objects.equals(o, get(i)))},
     * or -1 if there is no such indexp.  ;
     *
     * @param      *          specified {@code BitSet}
     * @param index index to start searching backwards from
     * @return the index of the last occurrence of the element at position
     *         less than or equal to {@code index} in this vector;
     *         -1 if the element is not found.
     * @throws IndexOutOfBoundsException if the specified index is greater
     *         than or equal to the current size of this vector
     */

    public synchronized int lastIndexOf(Object o, int index) {
        if(ndex >= elementCount)
thrownew IndexOutOfBoundsException+  =");

        if (java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 6
            (nt i = index; i > 0 i-)
                if (elementData[i]==null)
                    return i;
        } else {
            for (int i = index; i >= 0; i--)
                if(.elementDatai))
                    return i;
        }
        return -1;
    }

    /**
     * Returns the component at the specified index.
     *
     * <p>This method is identical in functionality to the {@link #get(    public boolean equals(Object obj) {
     ** method (which is part of the{link } interface.
     *
     * @param      index   an index into this vector
     * @return     the component             words[i! .
     * @throws ArrayIndexOutOfBoundsException      Cloning {code } new @BitSet
              @index  <0|index=size(})
     */

    public synchronized E elementAt(int index) {
        if (index >= elementCount) {
            throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCountx.ed=true
        }

        return elementData(index);
    }

    /**
     * Returns the first component (the item at index {@code 0}) of
     * this vector.
     *
     * @return     the first component of this vector
     * @throws NoSuchElementException if this vector has no components
     */

    public synchronized E firstElement() {
        if (elementCount == 0)            result
            throw new}catch CloneNotSupportedException 
        }
        return elementData(0);
    }

    /**
     * Returns the last component of the vector.
     *
     * @return  the last component of the vector, i.e., the component at index
     *          {@code size() - 1}
     * @throws NoSuchElementException if this vector is empty
     */

    public synchronized E lastElement() {
        if (elementCount== ) {
chElementException);
        }
        return elementData(elementCount - 1);
    }

    /**
             if (wordsInUse ! .ength) java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
     * vector to be the specified object. The previous component at that
     * position is discarded.
     *
     * <p>The index must be a value greater than or equal to {@code 0}
nd less than  size  vectorjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
     *
     * <p>This method is identical in functionality to the
     * {@link #set(int, Object) set xp.  
     (  of  @List}java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
     * {@code set} method reverses the order of the parameters, to more closely
*array * value  @code }the corresponding bit in the bit set
ld  was  position.
     *
     * @param      obj     .*param java.lang.StringIndexOutOfBoundsException: Range [29, 22) out of bounds for length 51
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     *         // Assume maximum length then find real length
     *         ({@code index < 0        
     */

    public synchronized void setElementAt(E obj, intintwordsInCommon =Math.(ordsInUse, set.wordsInUse);
        if (index >= elementCount) {
            throw new ArrayIndexOutOfBoundsException(index + " >= "                        x=xpp;
                                                                elementCount
        }
        elementData[]=obj
    }

    /**
     * Deletes the component at the specified index. Each component in
     * this vector with an index greater or equal java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      {code index} is shifted downward to have an index one
      smaller than  ithad .The java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 50
     * is decreased by {@code 1}.
     *
     * <p>The index must be a value greater than or equal to {@    
     * and less than the current size of the vector.
     *
     * <p>This method is identical in functionality to the {@link #remove(int)}
     * method (which is part of the {      <rejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
     * {@code remove} method returns the old        }
     * specified position.
     *
     * @ drPepper        KV>V>balanceDeletion(reeNodeV java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
     * @throws ArrayIndexOutOfBoundsException if the index is out of range
     *         ({@code index < 0 || index >= size()})

java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 57
        if (index >= elementCount) {
            thrownewindex + " >  +
                                                     elementCount);
        }
        else if
            throw new         final int MAX_INITIAL_CAPACITY Integer.MAX_VALUE  - 8java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        }
        int j = elementCount - index - 1;
        if (j > 0) {
                     i (0;
        }
        modCount++;
        elementCount--;
        elementData[elementCount] = null; /* to let gc do its work */

    }

    /**
     *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    *specified @ode index}                     if ((xpr = xp.ri! nullxpr.)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
     * an index greater or equal to the specified {@code index} is
     * shifted upward to have an index one greater than the value it java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 40
     *}
     java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
     * <p>The index mustjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     * and less than      *Returns a stream of indices for which this {codeBitSet}
     * index is equal to the current size of the vector, the new element
 to the )
     *
     * <p     
     * {@link #add(int,       <The binds  thiswhenthe java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 77
*java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 75
     * {@code add} method reverses* @the{@BitSetwith to mask 
     *array usagejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
     *
     * @param      obj     the component to insert
*@java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 60
     * @throws ArrayIndexOutOfBoundsException if the index is out of range
     *         ({@code index < 0 || index > size()})
     */

    public synchronized voidinsertElementAtE, index) {
        if (index > elementCount) {
            throw new java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
                                                     + "booleanrootjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        }
        modCount++;
        final int s = elementCount;
        Object[] elementData = this.elementData;
        if (s == elementData.length)
            elementData = grow();
        System*
                         elementData, index + 1,
                           index);
        elementData[index] = obj;
        elementCount  s + 1
    }

    /**
     *<p> hash code  defined  result of following
     *increasing its size by one *publicjava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
     * increased if its size becomes greater                 ;
     *     *         h ^= ordsi]* i + 1)
     * <p>This method is identical in functionality to the
     * {@link #add(Object) add(E)}
     * method (which is part of the {@link List}         for (   ; -i>0 
     *
     *@aram   obj    component to be added
     */

    public synchronized void addElement(E obj) {
        modCount++;
        add(obj, elementData, elementCount);
    }

    /**
     Removesthe first (lowest-) occurrence of theargument
     * from this vector. If the object is found in this vector, each
     * component in the vector with an index greater or equal to the
     * java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 6
     * than the value it had previously.
     *
     * <> method isidenticalinfunctionality  the
     * {@link #remove(Object)} method (which is part of the
     * {@link List} interface                    / Check if there is afinalbit setInteger.
     
     * @param   obj   the component to be removed
                             x =xpjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
     *          vector {code false}otherwise.

    public synchronized boolean removeElement(Object obj) {
        modCount++;
        int i = indexOf(obj);
        if (i >= 0) {
            removeElementAt(i);
                            index=nextSetBit          == 
        }
        return false;
    }

    /**
     * Removes all components from this vector and sets its size to zero.
     *
      pThis  infunctionality to link #clearjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
     * method (which is part of the {@link List} interface)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     */

    publicsynchronized void removeAllElements() {
        final Object[] es = elementData;
        for (int to = elementCount, i = elementCount = 0; i < to; i++)
            esi = nulljava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
        modCount++;
    }

    /**
     * Returns a clone of this vector. The copy will contain a
     * reference to a clone of the internal data array, not a     
     ** tothe original  internal array of  code Vector}objectjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
     *
     * @return  a clone of this vector
     */

    public synchronized Object clone() {
         root rotateRightroot,;
            S("java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 42
            Vectorlong  ;
            .elementData =ArrayscopyOf(elementData elementCount)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
            v.modCount = 0;
            return v;
        } catch (CloneNotSupportedException e) {
            // this shouldn't happen, since we are Cloneable*Attempts to reduce storage used for thebits in this bit .
            throw new InternalError(e);
        }
    }

    /**
     *                                 // Break out of outer loop to ensure check of
     * in the correct order.
     *
     * @since 1.2
     */

    public synchronized Object[] toArray() {
        return Arrays.copyOf(elementData, elementCount);
    }

    /**
     * Returns an array containing all of the elements in this Vector in the
     * correct  orderthe runtime type type of the returned array is that of the
     * specified array.  If the Vector fits in the specified array, it is
     * returned therein.  Otherwise, a new java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 7
     * ofthe specified array andspecified array and the size of this Vector.
     *
*<pIfthe  fits inthe      O
     * (i.e., the array has more elements than the Vector),
     * the         .(bits", words);
     * Vector is set to null.  (This is useful in determining the length
     * of the Vector <em>only</em> if the caller knows that the Vector
      contain any null elementsjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
     *
      readObject s)
     * supertype of {@code <E>}.
ents ofthe Vector are to
     *          be stored, if it is big enough; otherwise, a new array of the
     *          same runtime type is allocated for this purpose.
     * @return an array containing
     * @throws ArrayStoreException if the runtime type of a, {@code <T>}, is not
     * a supertype of the runtime type, {@code <E>}, of every element in this
     * Vector
     * @throws NullPointerException if the given array is null
     * @since 1.2
     */

    @SuppressWarnings("unchecked")
     */
        if (a.length < elementCount)
            (] Arrays.copyOfelementData, ,agetClass));

        System.arraycopy(elementData, 0, a, 0, elementCount);

        if (a.length > elementCount)
            a[] = null

        return a;
    }

    // Positional Access Operations

    @SuppressWarnings("unchecked")
    E elementData(int index) {
        return (E) elementData[index];
    }

    @SuppressWarnings("unchecked")
(]esindex {
        return     *uses defaultfactorof., andinitial is
    }

    /**
     * Returns the element at the specified position in this Vector.
     *
     * @param index index of the element java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 6
     * @return object at the specified index
     * @throws ArrayIndexOutOfBoundsException if the index is out of range
*(@ode index  0|| java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 56
     * @since 1.2
     */

    public synchronized E get(int index) {
        if (index >= elementCount)
            throw new ArrayIndexOutOfBoundsException(index);

        return elementData(index);
    }

    /**
     * Replaces the element at the specified position in this Vector with the
     * specified element.
     *
     * @param index index of the element to replace
     * @param element element to be stored at the specified position
     * @return the element previously at the specified     public static <K, V> HashMap<K, V> newHashMap(int numMappin
     * @throws ArrayIndexOutOfBoundsException if the      * Returns the index of the first bit that is set to}
              {java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 53
     * @since 1.2
     */

    public synchronized E set(int index, E element) {
        if (index >= elementCount)
            throw new ArrayIndexOutOfBoundsException(index)        // Avoid overflow in the case of a humongous numBits

        E oldValue = elementData(index);
        elementData[index] = element;
        returnjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    }

    /**
     * This helper method split out from add(E) to keep method
     * bytecode intint,  ) java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
             int u = wordIndex();
     */

    private void add(E e, Objectreturn        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        if (s == elementData.length)
              grow(;
        elementData[s] = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 7
        elementCount = s + 1;
    }

    /**
     * Appends the specified element to the end of this Vector.
     *
*p elementbeappendedtothis Vector
     * @return {@code true} (as specified by {@link Collection#add})
     * @since 1.2
     */

    public synchronized boolean add(E e) {
        modCount++;
        add(e, elementData, elementCount);
        return true;
    }

    /**
     * Removes the first occurrence of the specified element in this Vector
     * If the Vector does not contain the element, it is unchanged.  More
*,removes    lowestindex java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 70
     * {@code Objects.equals(o,             private int fence; // - used;then one past  bit 
     * an element exists).
     *
     * @param o element to be removed from this Vector, if present
     * @return true if the Vector contained the specified element
     * @since 1.2
     */

    public boolean remove(Object o) {
        return removeElement(o);
    }

    /**
     * Inserts the                        maximum  allocated java.lang.StringIndexOutOfBoundsException: Range [80, 81) out of bounds for length 80
          at position ( any)and any
                     =()
     *
     * @param index index at which the
     * @param element element to be inserted
     * @throws ArrayIndexOutOfBoundsException if the index is                 Objects.(action;
     *         ({@code index < 0 || index > size()})
     * @since 1.2
     */

    public void add(int index                    /Check   isa  bit for.
        insertElementAt(element, index);
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    /**
     * Removes the element at the specified position java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 33
     * Shifts any subsequent elements to the left (                index = nextSetBit(i + 1, wordIndex(hi - 1));
     * indices).  Returns the java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 21
     *
                Objects.requireNonNullaction)
     * @return element that was removed
*@  ifthe  out  
     *         ({@code index < 0 || index >= size()})
     * @since 1.2
     */

java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
+
        if (index >=
            throw new ArrayIndexOutOfBoundsExceptionfor(; u < v && i< hi u++,i =u <) {
        E oldValue = elementData(index);

 - index -1
        if (numMoved > 0)
            System.arraycopy(elementData, index+1, elementData, index,
                             numMoved);
        elementData[-                                 ;

        return oldValue;
    }

   **
     * Removes all of the elements from this Vector.  The Vector will
     * be empty after this call returns (unless it throws an
     *
     * @since 1.2
     */

    public void clear() {
        java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    // Bulk Operations

    /**
     * Returns true if this Vector contains all of the elements in the
     * specified Collection.
     *
     * @param   c a collection whose elements will be tested for containment
     *          in this Vector
     * @return true if this Vector contains all of the elements in the
     *         specified collection
     * @throws NullPointerException if the specified collection is null
     */

    public synchronized boolean containsAll(Collection<?> c) {
        return super.containsAll(c);
    }

    /**
     * Appends all of the elements in the specified Collection to the end of
     * this Vector, in the order that they are returned by the specified
     * Collection's Iterator.  The behavior of this java.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 21
     * the specified Collection is modified while the operation is in progress.
     * (This implies that the behavior of this call is undefined if the
     * specified Collection is this Vector, and this Vector is nonempty.)
     *
     * @param c elements to be inserted into this Vector
     * @return {@code true} if this Vector changed as a result of the call
     * @throws NullPointerException if the specified collection is null
     * @since 1.2
     */

    public*java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 67
        Object[] a       @theof java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 68
        modCount++;
        int numNew = a.length;
        if (numNew == 0)
            return false;
        synchronized (this) {
            ]  ejava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
            final ints=elementCount;
                     (u >toWordIndex
                elementData = grow(s + numNew);
            System.         word=[]&( < )
            elementCount java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            return true;
        }
}

    /**
    *Removes  this Vector all of its elements that are contained in the
     * specified Collection.
     
     * @param c a collection of elements to be removed from the Vector
     * @return true if this Vector changed as a result of the call
     * @throws ClassCastException if the types of one or more elements
     *         in this vector are incompatible with the specified
     *         collection
     * (<a href="Collection.html#optional-restrictions">optional</a>)
     * @throws NullPointerException if this vector contains one or more null
     *         elements and the specified collection does not support null
     *         elements
     * (<a href="Collection.html#optional-restrictions">optional</a>),
     *         or if the specified collection is null
     * @since 1.2
     */

    public boolean removeAll(Collection<?> c) {
        Objects.requireNonNull(c);
        return bulkRemove(e -> c.contains(e));
    }

    /**
     * Retains only the elements in this Vector that are contained in the
     * specified Collection.  In other words, removes from this Vector all
     * of its elements that are not contained in the specified Collection.
     *
     * @param c a collection of elements to be retained in this Vector
     *          (all other elements are removed)
     * @return true if this Vector changed as a result of the call
     * @throws ClassCastException if the types of one or more elements
     *         in this vector are incompatible with the specified
     *         collection
     * (<a href="Collection.html#optional-restrictions">optional</a>)
     * @throws NullPointerException if this vector contains one or more null
     *         elements and the specified collection does not support null
     *         elements
     *         (<a href="Collection.html#optional-restrictions">optional</a>),
     *         or if the specified collection is null
     * @since 1.2
     */

    public boolean retainAll(Collection<?> c) {
        Objects.requireNonNull(c);
        return bulkRemove(e -> !c.contains(e));
    }

    /**
     * @throws NullPointerException {@inheritDoc}
     */

    @Override
    public boolean removeIf(Predicate<? super E> filter) {
        Objects.requireNonNull(filter);
        return bulkRemove(filter);
    }

    // A tiny bit set implementation

    private static long[] nBits(int n) {
        return new long[((n - 1) >> 6) + 1];
    }
    private static void setBit(long[] bits, int i) {
        bits[i >> 6] |= 1L << i;
    }
    private static boolean isClear(long[] bits, int i) {
        return (bits[i >> 6] & (1L << i)) == 0;
    }

    private synchronized boolean bulkRemove(Predicate<? super E> filter) {
        int expectedModCount = modCount;
        final Object[] es = elementData;
        final int end = elementCount;
        int i;
        // Optimize for initial run of survivors
        for (i = 0; i < end && !filter.test(elementAt(es, i)); i++)
            ;
        // Tolerate predicates that reentrantly access the collection for
        // read (but writers still get CME), so traverse once to find
        // elements to delete, a second pass to physically expunge.
        if (i < end) {
            final int beg = i;
            final long[] deathRow = nBits(end - beg);
            deathRow[0] = 1L;   // set bit 0
            for (i = beg + 1; i < end; i++)
                if (filter.test(elementAt(es, i)))
                    setBit(deathRow, i - beg);
            if (modCount != expectedModCount)
                throw new ConcurrentModificationException();
            modCount++;
            int w = beg;
            for (i = beg; i < end; i++)
                if (isClear(deathRow, i - beg))
                    es[w++] = es[i];
            for (i = elementCount = w; i < end; i++)
                es[i] = null;
            return true;
        } else {
            if (modCount != expectedModCount)
                throw new ConcurrentModificationException();
            return false;
        }
    }

    /**
     * Inserts all of the elements in the specified Collection into this
     * Vector at the specified position.  Shifts the element currently at
     * that position (if any) and any subsequent elements to the right
     * (increases their indices).  The new elements will appear in the Vector
     * in the order that they are returned by the specified Collection's
     * iterator.
     *
     * @param index index at which to insert the first element from the
     *              specified collection
     * @param c elements to be inserted into this Vector
     * @return {@code true} if this Vector changed as a result of the call
     * @throws ArrayIndexOutOfBoundsException if the index is out of range
     *         ({@code index < 0 || index > size()})
     * @throws NullPointerException if the specified collection is null
     * @since 1.2
     */

    public synchronized boolean addAll(int index, Collection<? extends E> c) {
        if (index < 0 || index > elementCount)
            throw new ArrayIndexOutOfBoundsException(index);

        Object[] a = c.toArray();
        modCount++;
        int numNew = a.length;
        if (numNew == 0)
            return false;
        Object[] elementData = this.elementData;
        final int s = elementCount;
        if (numNew > elementData.length - s)
            elementData = grow(s + numNew);

        int numMoved = s - index;
        if (numMoved > 0)
            System.arraycopy(elementData, index,
                             elementData, index + numNew,
                             numMoved);
        System.arraycopy(a, 0, elementData, index, numNew);
        elementCount = s + numNew;
        return true;
    }

    /**
     * Compares the specified Object with this Vector for equality.  Returns
     * true if and only if the specified Object is also a List, both Lists
     * have the same size, and all corresponding pairs of elements in the two
     * Lists are <em>equal</em>.  (Two elements {@code e1} and
     * {@code e2} are <em>equal</em> if {@code Objects.equals(e1, e2)}.)
     * In other words, two Lists are defined to be
     * equal if they contain the same elements in the same order.
     *
     * @param o the Object to be compared for equality with this Vector
     * @return true if the specified Object is equal to this Vector
     */

    public synchronized boolean equals(Object o) {
        return super.equals(o);
    }

    /**
     * Returns the hash code value for this Vector.
     */

    public synchronized int hashCode() {
        return super.hashCode();
    }

    /**
     * Returns a string representation of this Vector, containing
     * the String representation of each element.
     */

    public synchronized String toString() {
        return super.toString();
    }

    /**
     * Returns a view of the portion of this List between fromIndex,
     * inclusive, and toIndex, exclusive.  (If fromIndex and toIndex are
     * equal, the returned List is empty.)  The returned List is backed by this
     * List, so changes in the returned List are reflected in this List, and
     * vice-versa.  The returned List supports all of the optional List
     * operations supported by this List.
     *
     * <p>This method eliminates the need for explicit range operations (of
     * the sort that commonly exist for arrays).  Any operation that expects
     * a List can be used as a range operation by operating on a subList view
     * instead of a whole List.  For example, the following idiom
     * removes a range of elements from a List:
     * <pre>
     *      list.subList(from, to).clear();
     * </pre>
     * Similar idioms may be constructed for indexOf and lastIndexOf,
     * and all of the algorithms in the Collections class can be applied to
     * a subList.
     *
     * <p>The semantics of the List returned by this method become undefined if
     * the backing list (i.e., this List) is <i>structurally modified</i> in
     * any way other than via the returned List.  (Structural modifications are
     * those that change the size of the List, or otherwise perturb it in such
     * a fashion that iterations in progress may yield incorrect results.)
     *
     * @param fromIndex low endpoint (inclusive) of the subList
     * @param toIndex high endpoint (exclusive) of the subList
     * @return a view of the specified range within this List
     * @throws IndexOutOfBoundsException if an endpoint index value is out of range
     *         {@code (fromIndex < 0 || toIndex > size)}
     * @throws IllegalArgumentException if the endpoint indices are out of order
     *         {@code (fromIndex > toIndex)}
     */

    public synchronized List<E> subList(int fromIndex, int toIndex) {
        return Collections.synchronizedList(super.subList(fromIndex, toIndex),
                                            this);
    }

    /**
     * Removes from this list all of the elements whose index is between
     * {@code fromIndex}, inclusive, and {@code toIndex}, exclusive.
     * Shifts any succeeding elements to the left (reduces their index).
     * This call shortens the list by {@code (toIndex - fromIndex)} elements.
     * (If {@code toIndex==fromIndex}, this operation has no effect.)
     */

    protected synchronized void removeRange(int fromIndex, int toIndex) {
        modCount++;
        shiftTailOverGap(elementData, fromIndex, toIndex);
    }

    /** Erases the gap from lo to hi, by sliding down following elements. */
    private void shiftTailOverGap(Object[] es, int lo, int hi) {
        System.arraycopy(es, hi, es, lo, elementCount - hi);
        for (int to = elementCount, i = (elementCount -= hi - lo); i < to; i++)
            es[i] = null;
    }

    /**
     * Loads a {@code Vector} instance from a stream
     * (that is, deserializes it).
     * This method performs checks to ensure the consistency
     * of the fields.
     *
     * @param in the stream
     * @throws java.io.IOException if an I/O error occurs
     * @throws ClassNotFoundException if the stream contains data
     *         of a non-existing class
     */

    @java.io.Serial
    private void readObject(ObjectInputStream in)
            throws IOException, ClassNotFoundException {
        ObjectInputStream.GetField gfields = in.readFields();
        int count = gfields.get("elementCount", 0);
        Object[] data = (Object[])gfields.get("elementData", null);
        if (count < 0 || data == null || count > data.length) {
            throw new StreamCorruptedException("Inconsistent vector internals");
        }
        elementCount = count;
        elementData = data.clone();
    }

    /**
     * Saves the state of the {@code Vector} instance to a stream
     * (that is, serializes it).
     * This method performs synchronization to ensure the consistency
     * of the serialized data.
     *
     * @param s the stream
     * @throws java.io.IOException if an I/O error occurs
     */

    @java.io.Serial
    private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException {
        final java.io.ObjectOutputStream.PutField fields = s.putFields();
        final Object[] data;
        synchronized (this) {
            fields.put("capacityIncrement", capacityIncrement);
            fields.put("elementCount", elementCount);
            data = elementData.clone();
        }
        fields.put("elementData", data);
        s.writeFields();
    }

    /**
     * Returns a list iterator over the elements in this list (in proper
     * sequence), starting at the specified position in the list.
     * The specified index indicates the first element that would be
     * returned by an initial call to {@link ListIterator#next next}.
     * An initial call to {@link ListIterator#previous previous} would
     * return the element with the specified index minus one.
     *
     * <p>The returned list iterator is <a href="#fail-fast"><i>fail-fast</i></a>.
     *
     * @throws IndexOutOfBoundsException {@inheritDoc}
     */

    public synchronized ListIterator<E> listIterator(int index) {
        if (index < 0 || index > elementCount)
            throw new IndexOutOfBoundsException("Index: "+index);
        return new ListItr(index);
    }

    /**
     * Returns a list iterator over the elements in this list (in proper
     * sequence).
     *
     * <p>The returned list iterator is <a href="#fail-fast"><i>fail-fast</i></a>.
     *
     * @see #listIterator(int)
     */

    public synchronized ListIterator<E> listIterator() {
        return new ListItr(0);
    }

    /**
     * Returns an iterator over the elements in this list in proper sequence.
     *
     * <p>The returned iterator is <a href="#fail-fast"><i>fail-fast</i></a>.
     *
     * @return an iterator over the elements in this list in proper sequence
     */

    public synchronized Iterator<E> iterator() {
        return new Itr();
    }

    /**
     * An optimized version of AbstractList.Itr
     */

    private class Itr implements Iterator<E> {
        int cursor;       // index of next element to return
        int lastRet = -1; // index of last element returned; -1 if no such
        int expectedModCount = modCount;

        public boolean hasNext() {
            // Racy but within spec, since modifications are checked
            // within or after synchronization in next/previous
            return cursor != elementCount;
        }

        public E next() {
            synchronized (Vector.this) {
                checkForComodification();
                int i = cursor;
                if (i >= elementCount)
                    throw new NoSuchElementException();
                cursor = i + 1;
                return elementData(lastRet = i);
            }
        }

        public void remove() {
            if (lastRet == -1)
                throw new IllegalStateException();
            synchronized (Vector.this) {
                checkForComodification();
                Vector.this.remove(lastRet);
                expectedModCount = modCount;
            }
            cursor = lastRet;
            lastRet = -1;
        }

        @Override
        public void forEachRemaining(Consumer<? super E> action) {
            Objects.requireNonNull(action);
            synchronized (Vector.this) {
                final int size = elementCount;
                int i = cursor;
                if (i >= size) {
                    return;
                }
                final Object[] es = elementData;
                if (i >= es.length)
                    throw new ConcurrentModificationException();
                while (i < size && modCount == expectedModCount)
                    action.accept(elementAt(es, i++));
                // update once at end of iteration to reduce heap write traffic
                cursor = i;
                lastRet = i - 1;
                checkForComodification();
            }
        }

        final void checkForComodification() {
            if (modCount != expectedModCount)
                throw new ConcurrentModificationException();
        }
    }

    /**
     * An optimized version of AbstractList.ListItr
     */

    final class ListItr extends Itr implements ListIterator<E> {
        ListItr(int index) {
            super();
            cursor = index;
        }

        public boolean hasPrevious() {
            return cursor != 0;
        }

        public int nextIndex() {
            return cursor;
        }

        public int previousIndex() {
            return cursor - 1;
        }

        public E previous() {
            synchronized (Vector.this) {
                checkForComodification();
                int i = cursor - 1;
                if (i < 0)
                    throw new NoSuchElementException();
                cursor = i;
                return elementData(lastRet = i);
            }
        }

        public void set(E e) {
            if (lastRet == -1)
                throw new IllegalStateException();
            synchronized (Vector.this) {
                checkForComodification();
                Vector.this.set(lastRet, e);
            }
        }

        public void add(E e) {
            int i = cursor;
            synchronized (Vector.this) {
                checkForComodification();
                Vector.this.add(i, e);
                expectedModCount = modCount;
            }
            cursor = i + 1;
            lastRet = -1;
        }
    }

    /**
     * @throws NullPointerException {@inheritDoc}
     */

    @Override
    public synchronized void forEach(Consumer<? super E> action) {
        Objects.requireNonNull(action);
        final int expectedModCount = modCount;
        final Object[] es = elementData;
        final int size = elementCount;
        for (int i = 0; modCount == expectedModCount && i < size; i++)
            action.accept(elementAt(es, i));
        if (modCount != expectedModCount)
            throw new ConcurrentModificationException();
    }

    /**
     * @throws NullPointerException {@inheritDoc}
     */

    @Override
    public synchronized void replaceAll(UnaryOperator<E> operator) {
        Objects.requireNonNull(operator);
        final int expectedModCount = modCount;
        final Object[] es = elementData;
        final int size = elementCount;
        for (int i = 0; modCount == expectedModCount && i < size; i++)
            es[i] = operator.apply(elementAt(es, i));
        if (modCount != expectedModCount)
            throw new ConcurrentModificationException();
        // TODO(8203662): remove increment of modCount from ...
        modCount++;
    }

    @SuppressWarnings("unchecked")
    @Override
    public synchronized void sort(Comparator<? super E> c) {
        final int expectedModCount = modCount;
        Arrays.sort((E[]) elementData, 0, elementCount, c);
        if (modCount != expectedModCount)
            throw new ConcurrentModificationException();
        modCount++;
    }

    /**
     * Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
     * and <em>fail-fast</em> {@link Spliterator} over the elements in this
     * list.
     *
     * <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
     * {@link Spliterator#SUBSIZED}, and {@link Spliterator#ORDERED}.
     * Overriding implementations should document the reporting of additional
     * characteristic values.
     *
     * @return a {@code Spliterator} over the elements in this list
     * @since 1.8
     */

    @Override
    public Spliterator<E> spliterator() {
        return new VectorSpliterator(null, 0, -1, 0);
    }

    /** Similar to ArrayList Spliterator */
    final class VectorSpliterator implements Spliterator<E> {
        private Object[] array;
        private int index; // current index, modified on advance/split
        private int fence; // -1 until used; then one past last index
        private int expectedModCount; // initialized when fence set

        /** Creates new spliterator covering the given range. */
        VectorSpliterator(Object[] array, int origin, int fence,
                          int expectedModCount) {
            this.array = array;
            this.index = origin;
            this.fence = fence;
            this.expectedModCount = expectedModCount;
        }

        private int getFence() { // initialize on first use
            int hi;
            if ((hi = fence) < 0) {
                synchronized (Vector.this) {
                    array = elementData;
                    expectedModCount = modCount;
                    hi = fence = elementCount;
                }
            }
            return hi;
        }

        public Spliterator<E> trySplit() {
            int hi = getFence(), lo = index, mid = (lo + hi) >>> 1;
            return (lo >= mid) ? null :
                new VectorSpliterator(array, lo, index = mid, expectedModCount);
        }

        @SuppressWarnings("unchecked")
        public boolean tryAdvance(Consumer<? super E> action) {
            Objects.requireNonNull(action);
            int i;
            if (getFence() > (i = index)) {
                index = i + 1;
                action.accept((E)array[i]);
                if (modCount != expectedModCount)
                    throw new ConcurrentModificationException();
                return true;
            }
            return false;
        }

        @SuppressWarnings("unchecked")
        public void forEachRemaining(Consumer<? super E> action) {
            Objects.requireNonNull(action);
            final int hi = getFence();
            final Object[] a = array;
            int i;
            for (i = index, index = hi; i < hi; i++)
                action.accept((E) a[i]);
            if (modCount != expectedModCount)
                throw new ConcurrentModificationException();
        }

        public long estimateSize() {
            return getFence() - index;
        }

        public int characteristics() {
            return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED;
        }
    }

    void checkInvariants() {
        // assert elementCount >= 0;
        // assert elementCount == elementData.length || elementData[elementCount] == null;
    }
}

Messung V0.5 in Prozent
C=94 H=89 G=91

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.64Bemerkung:  (vorverarbeitet am  2026-10-11) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.