@SuppressWarnings("varargs")
    public static <T> List<T> of(T value1, T value2) {
        // Note that AbstractList is immutable by default.
        return new AbstractList<T>() {
            @Override
            public T get(int index) {
                switch (index) {
                    case 0:
                        return value1;
                    case 1:
                        return value2;
                    default:
                        throw new IndexOutOfBoundsException("Index: " + index + ", Size: 2");
                }
            }

            @Override
            public int size() {
                return 2;
            }
        };
    }
Returns an unmodifiable list containing two entries.

@param value1 The first value.
@param value2 The second value.
@param <T> the List's value type.
@return a List containing the specified values.
smithy-utils/src/main/java/software/amazon/smithy/utils/ListUtils.java