Ranides Atterwim 2 tahun lalu
induk
melakukan
5b41f8ebb2

+ 4 - 74
assira.core/src/main/java/net/ranides/assira/collection/lists/FlatList.java

@@ -6,8 +6,6 @@
  */
 package net.ranides.assira.collection.lists;
 
-import net.ranides.assira.collection.sets.FlatSet;
-
 import java.io.Serializable;
 import java.util.*;
 import java.util.stream.Stream;
@@ -45,7 +43,7 @@ public class FlatList<T> extends AbstractSequentialList<T> implements Serializab
     @SafeVarargs
     public FlatList(List<T>... values) {
         this();
-        joinAll(Arrays.asList(values));
+        content.addAll(Arrays.asList(values));
     }
 
     /**
@@ -54,30 +52,18 @@ public class FlatList<T> extends AbstractSequentialList<T> implements Serializab
      */
     public FlatList(Stream<List<T>> values) {
         this();
-        joinAll(values);
+        values.forEachOrdered(content::add);
     }
 
     /**
      * Creates merged view of provided lists
      * @param values values
      */
-    public FlatList(List<List<T>> values) {
+    public FlatList(Collection<List<T>> values) {
         this();
-        joinAll(values);
+        content.addAll(values);
     }
 
-    /**
-     * Creates merged view of provided collections
-     *
-     * @param values values
-     * @param <T> type
-     * @return view
-     */
-    @SafeVarargs
-    public static <T> FlatList<T> of(List<T>... values) {
-        return new FlatList<T>(values);
-    }
-    
     /**
      * Inserts list at the end of merged view.
      * Please note that it stores container, not actual elements from it.
@@ -89,62 +75,6 @@ public class FlatList<T> extends AbstractSequentialList<T> implements Serializab
         content.add(list);
         return this;
     }
-    
-    /**
-     * Inserts list into at specified position merged view.
-     * Please note that it stores container, not actual elements from it.
-     *
-     * Parameter "index" is related to merged lists, not elements.
-     * That means: if you merged 4 lists of size 10, then you can join at positions: 0...3, not 0...40
-     *
-     * @param index index
-     * @param list list
-     * @return this
-     */
-    public FlatList<T> join(int index, List<T> list) {
-        content.add(index, list);
-        return this;
-    }
-    
-    /***
-     * Inserts specified list at the end of merged view.
-     * Please note that it stores containers, not actual elements from them.
-     *
-     * @param list list
-     * @return this
-     */
-    public final FlatList<T> joinAll(List<List<T>> list) {
-        content.addAll(list);
-        return this;
-    }
-
-    /***
-     * Inserts specified lists at the end of merged view.
-     * Please note that it stores containers, not actual elements from them.
-     *
-     * @param stream stream
-     * @return this
-     */
-    public final FlatList<T> joinAll(Stream<List<T>> stream) {
-        stream.forEachOrdered(content::add);
-        return this;
-    }
-    
-    /**
-     * Inserts specified lists at the end of merged view.
-     * Please note that it stores containers, not actual elements from them.
-     *
-     * Parameter "index" is related to merged lists, not elements.
-     * That means: if you merged 4 lists of size 10, then you can join at positions: 0...3, not 0...40
-     *
-     * @param index index
-     * @param list list
-     * @return this
-     */
-    public final FlatList<T> joinAll(int index, List<List<T>> list) {
-        content.addAll(index, list);
-        return this;
-    }
 
     @Override
     public int size() {

+ 1 - 13
assira.core/src/test/java/net/ranides/assira/collection/lists/FlatListTest.java

@@ -15,7 +15,6 @@ import net.ranides.assira.collection.arrays.ArrayUtils;
 import net.ranides.test.data.TMaps;
 import net.ranides.test.data.TPoint;
 import net.ranides.test.data.TCollection;
-import static net.ranides.assira.junit.NewAssert.*;
 import org.junit.Test;
 
 /**
@@ -55,18 +54,7 @@ public class FlatListTest {
 			.run();
 	
 	}
-	
-	@Test
-	public void testJoinAll() {
-		FlatList<Integer> list= new FlatList<>();
-		list.join(a(10,11,12,13));
-		list.joinAll(a(a(21,22),a(31,32)));
-		list.joinAll(1, a(a(41,42),a(51,52)));
-		list.join(2, a(61,62));
-		
-		assertEquals(a(10, 11, 12, 13, 41, 42, 61, 62, 51, 52, 21, 22, 31, 32), list);
-	}
-	
+
     @SafeVarargs
 	private static <T> List<T> a(T... values) {
 		return Arrays.asList(values);