// Path: src/main/java/ch/codebulb/lambdaomega/L.java
// public static <T> L<T> l() {
//     return new L<>(new ArrayList<>());
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/L.java
// public static <T> List<T> list(T... ts) {
//     return l(ts).l;
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/M.java
// public static <K, V> E<K, V> e(K k, V v) {
//     return new E(k, v);
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/M.java
// public static M m() {
//     return m(new LinkedHashMap<>());
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/S.java
// public static <T> Set<T> set(T... ts) {
//     return C.toSet(ts);
// }
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final List<Integer> EXPECTED_LIST = new ArrayList<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final Map<String, Integer> EXPECTED_MAP = new LinkedHashMap<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final Map<String, Integer> EXPECTED_MAP_2_ELEMENTS = new LinkedHashMap<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static <T> void assertEquals(T expected, T... actual) {
//     Arrays.stream(actual).forEach(it -> Assert.assertEquals(expected, it));
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/abstractions/IndexedListI.java
// public static class IndexAlreadyPresentException extends RuntimeException {
//     // cannot use generics in Throwable
//     public final Object key;
//     public final Object previousValue;
// 
//     public IndexAlreadyPresentException(Object key, Object previousValue) {
//         super("Duplicate key found in map. Use #set(...) to override a value. Key: " + key + ", previous value: " + previousValue);
//         this.key = key;
//         this.previousValue = previousValue;
//     }
// }


import static ch.codebulb.lambdaomega.L.l;
import static ch.codebulb.lambdaomega.L.list;
import static ch.codebulb.lambdaomega.M.e;
import static ch.codebulb.lambdaomega.M.m;
import static ch.codebulb.lambdaomega.S.set;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_LIST;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_MAP;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_MAP_2_ELEMENTS;
import static ch.codebulb.lambdaomega.TestUtil.assertEquals;
import ch.codebulb.lambdaomega.abstractions.IndexedListI.IndexAlreadyPresentException;
import java.util.Map;
import static org.junit.Assert.fail;
import org.junit.Test;
package ch.codebulb.lambdaomega;


/**
 * Test cases for the {@link M} implementation for {@link IndexedI}.
 */
public class MBaseIndexedTest {
    @Test
    public void testAdd() {
        // Add individual elements
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).Insert("b", 1).m);
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).i("b", 1).m);
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).insert("b", 1));
        
        M<String, Integer> addMap = m("a", 0).i("b", 1);
        try {
            addMap.Insert("b", 2);
            fail();
        }
// Path: src/main/java/ch/codebulb/lambdaomega/L.java
// public static <T> L<T> l() {
//     return new L<>(new ArrayList<>());
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/L.java
// public static <T> List<T> list(T... ts) {
//     return l(ts).l;
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/M.java
// public static <K, V> E<K, V> e(K k, V v) {
//     return new E(k, v);
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/M.java
// public static M m() {
//     return m(new LinkedHashMap<>());
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/S.java
// public static <T> Set<T> set(T... ts) {
//     return C.toSet(ts);
// }
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final List<Integer> EXPECTED_LIST = new ArrayList<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final Map<String, Integer> EXPECTED_MAP = new LinkedHashMap<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static final Map<String, Integer> EXPECTED_MAP_2_ELEMENTS = new LinkedHashMap<>();
// 
// Path: src/test/java/ch/codebulb/lambdaomega/TestUtil.java
// public static <T> void assertEquals(T expected, T... actual) {
//     Arrays.stream(actual).forEach(it -> Assert.assertEquals(expected, it));
// }
// 
// Path: src/main/java/ch/codebulb/lambdaomega/abstractions/IndexedListI.java
// public static class IndexAlreadyPresentException extends RuntimeException {
//     // cannot use generics in Throwable
//     public final Object key;
//     public final Object previousValue;
// 
//     public IndexAlreadyPresentException(Object key, Object previousValue) {
//         super("Duplicate key found in map. Use #set(...) to override a value. Key: " + key + ", previous value: " + previousValue);
//         this.key = key;
//         this.previousValue = previousValue;
//     }
// }


// Path: src/test/java/ch/codebulb/lambdaomega/MBaseIndexedTest.java
import static ch.codebulb.lambdaomega.L.l;
import static ch.codebulb.lambdaomega.L.list;
import static ch.codebulb.lambdaomega.M.e;
import static ch.codebulb.lambdaomega.M.m;
import static ch.codebulb.lambdaomega.S.set;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_LIST;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_MAP;
import static ch.codebulb.lambdaomega.TestUtil.EXPECTED_MAP_2_ELEMENTS;
import static ch.codebulb.lambdaomega.TestUtil.assertEquals;
import ch.codebulb.lambdaomega.abstractions.IndexedListI.IndexAlreadyPresentException;
import java.util.Map;
import static org.junit.Assert.fail;
import org.junit.Test;

package ch.codebulb.lambdaomega;


/**
 * Test cases for the {@link M} implementation for {@link IndexedI}.
 */
public class MBaseIndexedTest {
    @Test
    public void testAdd() {
        // Add individual elements
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).Insert("b", 1).m);
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).i("b", 1).m);
        assertEquals(EXPECTED_MAP_2_ELEMENTS, m("a", 0).insert("b", 1));
        
        M<String, Integer> addMap = m("a", 0).i("b", 1);
        try {
            addMap.Insert("b", 2);
            fail();
        }
        catch (IndexAlreadyPresentException ex) {