ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/SynchronizedCollection.java
(Generate patch)

Comparing jsr166/src/test/loops/SynchronizedCollection.java (file contents):
Revision 1.3 by jsr166, Wed Sep 1 07:20:36 2010 UTC vs.
Revision 1.8 by jsr166, Wed Dec 31 17:00:58 2014 UTC

# Line 1 | Line 1
1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   // Stand-alone version of java.util.Collections.synchronizedCollection
9 import java.util.*;
8   import java.io.*;
9 + import java.util.*;
10  
11   public final class SynchronizedCollection<E> implements Collection<E>, Serializable {
12 <    final Collection<E> c;         // Backing Collection
13 <    final Object           mutex;  // Object on which to synchronize
12 >    final Collection<E> c;      // Backing Collection
13 >    final Object mutex;         // Object on which to synchronize
14  
15      public SynchronizedCollection(Collection<E> c) {
16          if (c==null)
# Line 29 | Line 28 | public final class SynchronizedCollectio
28      }
29  
30      public final int size() {
31 <        synchronized(mutex) {return c.size();}
31 >        synchronized (mutex) {return c.size();}
32      }
33      public final boolean isEmpty() {
34 <        synchronized(mutex) {return c.isEmpty();}
34 >        synchronized (mutex) {return c.isEmpty();}
35      }
36      public final boolean contains(Object o) {
37 <        synchronized(mutex) {return c.contains(o);}
37 >        synchronized (mutex) {return c.contains(o);}
38      }
39      public final Object[] toArray() {
40 <        synchronized(mutex) {return c.toArray();}
40 >        synchronized (mutex) {return c.toArray();}
41      }
42      public final <T> T[] toArray(T[] a) {
43 <        synchronized(mutex) {return c.toArray(a);}
43 >        synchronized (mutex) {return c.toArray(a);}
44      }
45  
46      public final Iterator<E> iterator() {
# Line 49 | Line 48 | public final class SynchronizedCollectio
48      }
49  
50      public final boolean add(E e) {
51 <        synchronized(mutex) {return c.add(e);}
51 >        synchronized (mutex) {return c.add(e);}
52      }
53      public final boolean remove(Object o) {
54 <        synchronized(mutex) {return c.remove(o);}
54 >        synchronized (mutex) {return c.remove(o);}
55      }
56  
57      public final boolean containsAll(Collection<?> coll) {
58 <        synchronized(mutex) {return c.containsAll(coll);}
58 >        synchronized (mutex) {return c.containsAll(coll);}
59      }
60      public final boolean addAll(Collection<? extends E> coll) {
61 <        synchronized(mutex) {return c.addAll(coll);}
61 >        synchronized (mutex) {return c.addAll(coll);}
62      }
63      public final boolean removeAll(Collection<?> coll) {
64 <        synchronized(mutex) {return c.removeAll(coll);}
64 >        synchronized (mutex) {return c.removeAll(coll);}
65      }
66      public final boolean retainAll(Collection<?> coll) {
67 <        synchronized(mutex) {return c.retainAll(coll);}
67 >        synchronized (mutex) {return c.retainAll(coll);}
68      }
69      public final void clear() {
70 <        synchronized(mutex) {c.clear();}
70 >        synchronized (mutex) {c.clear();}
71      }
72      public final String toString() {
73 <        synchronized(mutex) {return c.toString();}
73 >        synchronized (mutex) {return c.toString();}
74      }
75      private void writeObject(ObjectOutputStream s) throws IOException {
76 <        synchronized(mutex) {s.defaultWriteObject();}
76 >        synchronized (mutex) {s.defaultWriteObject();}
77      }
78   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines