author | dl |
Fri, 01 Nov 2019 09:04:04 -0700 | |
changeset 58892 | 35bac2745d04 |
parent 47304 | 3f5f9bc0bdc2 |
permissions | -rw-r--r-- |
47304
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
1 |
/* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
3 |
* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
4 |
* This code is free software; you can redistribute it and/or modify it |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation. |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
7 |
* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
12 |
* accompanied this code). |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
13 |
* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License version |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
17 |
* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
19 |
* or visit www.oracle.com if you need additional information or have any |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
20 |
* questions. |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
21 |
*/ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
22 |
|
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
23 |
/* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
24 |
* This file is available under and governed by the GNU General Public |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
25 |
* License version 2 only, as published by the Free Software Foundation. |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
26 |
* However, the following notice accompanied the original version of this |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
27 |
* file: |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
28 |
* |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
29 |
* Written by Doug Lea and Martin Buchholz with assistance from |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
30 |
* members of JCP JSR-166 Expert Group and released to the public |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
31 |
* domain, as explained at |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
32 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
33 |
*/ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
34 |
|
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
35 |
import java.util.Map; |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
36 |
|
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
37 |
/** Allows tests to work with different Map implementations. */ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
38 |
public interface MapImplementation { |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
39 |
/** Returns the Map implementation class. */ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
40 |
public Class<?> klazz(); |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
41 |
/** Returns an empty map. */ |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
42 |
public Map emptyMap(); |
58892
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
43 |
|
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
44 |
// General purpose implementations can use Integers for key and value |
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
45 |
default Object makeKey(int i) { return i; } |
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
46 |
default Object makeValue(int i) { return i; } |
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
47 |
default int keyToInt(Object key) { return (Integer) key; } |
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
48 |
default int valueToInt(Object value) { return (Integer) value; } |
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
49 |
|
47304
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
50 |
public boolean isConcurrent(); |
58892
35bac2745d04
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
dl
parents:
47304
diff
changeset
|
51 |
default boolean remappingFunctionCalledAtMostOnce() { return true; }; |
47304
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
52 |
public boolean permitsNullKeys(); |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
53 |
public boolean permitsNullValues(); |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
54 |
public boolean supportsSetValue(); |
3f5f9bc0bdc2
8186171: HashMap: Entry.setValue may not work after Iterator.remove() called for previous entries
dl
parents:
diff
changeset
|
55 |
} |