class CodeBlocks {

    @Nonnull
    public static CodeBlock createUnmodifiableStatement(@Nonnull TypeMirror type, @Nonnull String variable) {
        if (type.getKind() == TypeKind.ARRAY) {
            return CodeBlock.of("$T.copyOf($N, $N.length)", Arrays.class, variable, variable);
        }

        if (MoreTypes.isTypeOf(List.class, type)) {
            return CodeBlock.of("new $T<>($N)", ArrayList.class, variable);
        }

        if (MoreTypes.isTypeOf(Set.class, type)) {
            return CodeBlock.of("new $T<>($N)", HashSet.class, variable);
        }

        if (MoreTypes.isTypeOf(Map.class, type)) {
            return CodeBlock.of("new $T<>($N)", HashMap.class, variable);
        }
        return CodeBlock.of("$N", variable);
    }

    private  CodeBlocks();

}