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.6 by jsr166, Mon Dec 5 04:08:46 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines