@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Either<?, ?> either = (Either<?, ?>) o;
        return right == either.right && Objects.equals(value, either.value);
    }
@Test
    void testEquals() {
        assertEquals(Either.<String, Integer>ofRight(1), right);
        assertNotEquals(Either.<String, Integer>ofRight(2), right);
        assertEquals(Either.<String, Integer>ofRight(1).hashCode(), right.hashCode());
        assertNotEquals(Either.<String, Integer>ofRight(2).hashCode(), right.hashCode());
        assertTrue(right.isRightEqual(1));
        assertFalse(right.isRightEqual(2));

        assertEquals(Either.<String, Integer>ofLeft("A"), left);
        assertNotEquals(Either.<String, Integer>ofLeft("B"), left);
        assertEquals(Either.<String, Integer>ofLeft("A").hashCode(), left.hashCode());
        assertNotEquals(Either.<String, Integer>ofLeft("B").hashCode(), left.hashCode());
        assertFalse(left.isRightEqual(1));
        assertFalse(left.isRightEqual(2));
    }