1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.runtime
.cldc
.util
;
12 import java
.util
.AbstractSet
;
13 import java
.util
.Iterator
;
18 * This is an entry set which is synchronized against a lock, null values
21 * @param <K> The entry keys.
22 * @param <V> The entry values.
25 public final class SynchronizedEntrySetNotNull
<K
, V
>
26 extends AbstractSet
<Map
.Entry
<K
, V
>>
28 /** The locking object. */
29 protected final Object lock
;
31 /** The backing set. */
32 protected final Set
<Map
.Entry
<K
, V
>> set
;
35 * Initializes the synchronized entry set.
37 * @param __lock The locking object.
38 * @param __set The entry set object.
39 * @throws NullPointerException On null arguments.
42 public SynchronizedEntrySetNotNull(Object __lock
,
43 Set
<Map
.Entry
<K
, V
>> __set
)
44 throws NullPointerException
46 if (__lock
== null || __set
== null)
47 throw new NullPointerException("NARG");
58 public final Iterator
<Map
.Entry
<K
, V
>> iterator()
60 Object lock
= this.lock
;
63 return new SynchronizedEntrySetIteratorNotNull
<K
, V
>(
64 lock
, this.set
.iterator());
73 public final int size()
75 synchronized (this.lock
)
77 return this.set
.size();