src/java.base/share/classes/java/util/Comparators.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 47216 71c04702a3d5
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 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
    60 
    60 
    61     /**
    61     /**
    62      * Null-friendly comparators
    62      * Null-friendly comparators
    63      */
    63      */
    64     static final class NullComparator<T> implements Comparator<T>, Serializable {
    64     static final class NullComparator<T> implements Comparator<T>, Serializable {
       
    65         @java.io.Serial
    65         private static final long serialVersionUID = -7569533591570686392L;
    66         private static final long serialVersionUID = -7569533591570686392L;
    66         private final boolean nullFirst;
    67         private final boolean nullFirst;
    67         // if null, non-null Ts are considered equal
    68         // if null, non-null Ts are considered equal
       
    69         @SuppressWarnings("serial") // Not statically typed as Serializable
    68         private final Comparator<T> real;
    70         private final Comparator<T> real;
    69 
    71 
    70         @SuppressWarnings("unchecked")
    72         @SuppressWarnings("unchecked")
    71         NullComparator(boolean nullFirst, Comparator<? super T> real) {
    73         NullComparator(boolean nullFirst, Comparator<? super T> real) {
    72             this.nullFirst = nullFirst;
    74             this.nullFirst = nullFirst;