File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
main/java/org/javimmutable/collections/common
test/java/org/javimmutable/collections/array/trie32 Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 4343import org .javimmutable .collections .JImmutableMap ;
4444import org .javimmutable .collections .MapEntry ;
4545import org .javimmutable .collections .cursors .TransformCursor ;
46- import org .javimmutable .collections .hash .ArrayToMapAdaptor ;
4746
4847import java .util .Iterator ;
4948import java .util .Map ;
Original file line number Diff line number Diff line change 3333// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
36- package org .javimmutable .collections .hash ;
36+ package org .javimmutable .collections .common ;
3737
3838import org .javimmutable .collections .Func1 ;
3939import org .javimmutable .collections .Holder ;
4040import org .javimmutable .collections .JImmutableArray ;
4141import org .javimmutable .collections .JImmutableMap ;
4242import org .javimmutable .collections .MapEntry ;
43- import org .javimmutable .collections .common .IteratorAdaptor ;
4443import org .javimmutable .collections .cursors .TransformCursor ;
4544
4645import java .util .AbstractCollection ;
@@ -112,7 +111,7 @@ public boolean containsValue(Object o)
112111 @ Override
113112 public T get (Object o )
114113 {
115- return map .find ((Integer )o ). getValueOrNull ( );
114+ return map .get ((Integer )o );
116115 }
117116
118117 @ Override
Original file line number Diff line number Diff line change 4646import java .util .Arrays ;
4747import java .util .Collections ;
4848import java .util .List ;
49+ import java .util .Map ;
50+ import java .util .TreeMap ;
4951
5052public class Trie32ArrayTest
5153 extends TestCase
@@ -84,15 +86,19 @@ public void testVarious()
8486 {
8587 List <Integer > indexes = createBranchIndexes ();
8688 for (int length = indexes .size (); length > 0 ; --length ) {
89+ Map <Integer , Integer > map = new TreeMap <Integer , Integer >();
8790 List <Integer > keys = new ArrayList <Integer >();
8891 List <Integer > values = new ArrayList <Integer >();
8992 Trie32Array <Integer > array = Trie32Array .of ();
9093 for (int i = 0 ; i < length ; ++i ) {
91- array = array .assign (indexes .get (i ), i );
92- keys .add (indexes .get (i ));
94+ final Integer index = indexes .get (i );
95+ array = array .assign (index , i );
96+ keys .add (index );
9397 values .add (i );
98+ map .put (index , i );
9499 assertEquals (i + 1 , array .size ());
95100 }
101+ assertEquals (array .getMap (), map );
96102 StandardCursorTest .listCursorTest (keys , array .keysCursor ());
97103 StandardCursorTest .listCursorTest (values , array .valuesCursor ());
98104 for (int i = 0 ; i < length ; ++i ) {
You can’t perform that action at this time.
0 commit comments