This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3676
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/CAUSEWAY-3676 by this push:
     new 028ae52761 CAUSEWAY-3676: deletes _BiMap, not required
028ae52761 is described below

commit 028ae52761f98735fb636cd675a32d1c8a6effe0
Author: danhaywood <[email protected]>
AuthorDate: Sat Jan 20 11:00:18 2024 +0000

    CAUSEWAY-3676: deletes _BiMap, not required
---
 .../causeway/viewer/graphql/model/util/_BiMap.java | 48 -----------
 .../viewer/graphql/model/util/_BiMap_Test.java     | 99 ----------------------
 2 files changed, 147 deletions(-)

diff --git 
a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/util/_BiMap.java
 
b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/util/_BiMap.java
deleted file mode 100644
index df70cf63bf..0000000000
--- 
a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/util/_BiMap.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.causeway.viewer.graphql.model.util;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class _BiMap<K, V> {
-    private final Map<K, V> forwardMap = new LinkedHashMap<>();
-    private final Map<V, K> inverseMap = new LinkedHashMap<>();
-
-    public void put(K key, V value) {
-        forwardMap.put(key, value);
-        inverseMap.put(value, key);
-    }
-
-    public V get(K key) {
-        return forwardMap.get(key);
-    }
-
-    public _BiMap<V, K> inverse() {
-        _BiMap<V, K> inverseBiMap = new _BiMap<>();
-        inverseBiMap.forwardMap.putAll(inverseMap);
-        inverseBiMap.inverseMap.putAll(forwardMap);
-        return inverseBiMap;
-    }
-
-    public boolean isEmpty() {
-        return forwardMap.isEmpty();
-    }
-
-    public Set<Map.Entry<K, V>> entrySet() {
-        return forwardMap.entrySet();
-    }
-
-    public Set<K> keySet() {
-        return forwardMap.keySet();
-    }
-
-    public Collection<V> values() {
-        return forwardMap.values();
-    }
-
-    public Map<K, V> getForwardMapAsImmutable() {
-        return Collections.unmodifiableMap(forwardMap);
-    }
-}
\ No newline at end of file
diff --git 
a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/model/util/_BiMap_Test.java
 
b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/model/util/_BiMap_Test.java
deleted file mode 100644
index f74023840d..0000000000
--- 
a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/model/util/_BiMap_Test.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.apache.causeway.viewer.graphql.model.util;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.causeway.viewer.graphql.model.util._BiMap;
-import org.junit.jupiter.api.Test;
-import static org.assertj.core.api.Assertions.*;
-
-public class _BiMap_Test {
-
-    @Test
-    public void testPutAndGet() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        assertThat(biMap.get("one")).isEqualTo(1);
-        assertThat(biMap.get("two")).isEqualTo(2);
-        assertThat(biMap.get("nonexistent")).isNull();
-    }
-
-    @Test
-    public void testInverse() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        _BiMap<Integer, String> inverseBiMap = biMap.inverse();
-
-        assertThat(inverseBiMap.get(1)).isEqualTo("one");
-        assertThat(inverseBiMap.get(2)).isEqualTo("two");
-        assertThat(inverseBiMap.get(3)).isNull();
-    }
-
-    @Test
-    public void testIsEmpty() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        assertThat(biMap.isEmpty()).isTrue();
-
-        biMap.put("one", 1);
-        assertThat(biMap.isEmpty()).isFalse();
-    }
-
-    @Test
-    public void testEntrySet() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        Set<Map.Entry<String, Integer>> entrySet = biMap.entrySet();
-
-        assertThat(entrySet).containsExactlyInAnyOrder(
-                Map.entry("one", 1),
-                Map.entry("two", 2)
-        );
-    }
-
-    @Test
-    public void testKeySet() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        Set<String> keySet = biMap.keySet();
-
-        assertThat(keySet).containsExactlyInAnyOrder("one", "two");
-    }
-
-    @Test
-    public void testValues() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        Collection<Integer> values = biMap.values();
-
-        assertThat(values).containsExactlyInAnyOrder(1, 2);
-    }
-
-    @Test
-    public void testGetForwardMapAsImmutable() {
-        _BiMap<String, Integer> biMap = new _BiMap<>();
-        biMap.put("one", 1);
-        biMap.put("two", 2);
-
-        Map<String, Integer> immutableForwardMap = 
biMap.getForwardMapAsImmutable();
-
-        assertThat(immutableForwardMap).containsExactly(
-                Map.entry("one", 1),
-                Map.entry("two", 2)
-        );
-
-        // Ensure the immutable map cannot be modified
-        assertThatThrownBy(() -> immutableForwardMap.put("three", 3))
-                .isInstanceOf(UnsupportedOperationException.class);
-    }
-}

Reply via email to