src/java.base/share/classes/java/util/Collections.java
changeset 55702 339e544d59e3
parent 53107 cfceb4df2499
child 57956 e0b8b019d2f5
equal deleted inserted replaced
55694:7b7df2be6219 55702:339e544d59e3
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    24  */
    24  */
    25 
    25 
    26 package java.util;
    26 package java.util;
    27 
    27 
    28 import java.io.IOException;
    28 import java.io.IOException;
       
    29 import java.io.ObjectInputStream;
    29 import java.io.ObjectOutputStream;
    30 import java.io.ObjectOutputStream;
    30 import java.io.Serializable;
    31 import java.io.Serializable;
    31 import java.lang.reflect.Array;
    32 import java.lang.reflect.Array;
    32 import java.util.function.BiConsumer;
    33 import java.util.function.BiConsumer;
    33 import java.util.function.BiFunction;
    34 import java.util.function.BiFunction;
    37 import java.util.function.Predicate;
    38 import java.util.function.Predicate;
    38 import java.util.function.UnaryOperator;
    39 import java.util.function.UnaryOperator;
    39 import java.util.stream.IntStream;
    40 import java.util.stream.IntStream;
    40 import java.util.stream.Stream;
    41 import java.util.stream.Stream;
    41 import java.util.stream.StreamSupport;
    42 import java.util.stream.StreamSupport;
       
    43 import jdk.internal.access.SharedSecrets;
    42 
    44 
    43 /**
    45 /**
    44  * This class consists exclusively of static methods that operate on or return
    46  * This class consists exclusively of static methods that operate on or return
    45  * collections.  It contains polymorphic algorithms that operate on
    47  * collections.  It contains polymorphic algorithms that operate on
    46  * collections, "wrappers", which return a new collection backed by a
    48  * collections, "wrappers", which return a new collection backed by a
  5161 
  5163 
  5162         @Override
  5164         @Override
  5163         public Spliterator<E> spliterator() {
  5165         public Spliterator<E> spliterator() {
  5164             return stream().spliterator();
  5166             return stream().spliterator();
  5165         }
  5167         }
       
  5168 
       
  5169         private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
       
  5170             ois.defaultReadObject();
       
  5171             SharedSecrets.getJavaObjectInputStreamAccess().checkArray(ois, Object[].class, n);
       
  5172         }
  5166     }
  5173     }
  5167 
  5174 
  5168     /**
  5175     /**
  5169      * Returns a comparator that imposes the reverse of the <em>natural
  5176      * Returns a comparator that imposes the reverse of the <em>natural
  5170      * ordering</em> on a collection of objects that implement the
  5177      * ordering</em> on a collection of objects that implement the