33
Comments
  • 3
    Why though?
  • 3
    @Zaphod65 Just not enjoying working with it and I'm stuck with it :(

    There's just so much backwards compatibility everywhere that I can't do simple things like declare an array of a generic type without declaring an array of Object, casting and getting a compiler warning about it :/
  • 1
    Pro tip: code in whatever​ fits you
  • 2
    @dontPanic Yeah I do when I can, work though :(
  • 2
    @Jamoyjamie
    What do you mean 'declare an array of generic type'?
  • 4
    Then use the Collection API. Why would you use an array?
  • 3
    @linux-colonel As in if I had a class:
    MyClass<T>
    I can't define an array of it:
    MyClass<Integer>[]

    @Makenshi I'd like to but it's Swing that requires an array as a parameter... I managed to find another way in the end though.
  • 1
    @Jamoyjamie
    Ahh gotcha. I assume you just did something like this instead?

    public class MyIntegerClass extends MyClass<Integer>{}

    MyIntegerClass[] arr = new MyIntegerClass[] {}
  • 3
    @linux-colonel Actually in the end I managed to use a different constructor which did a similar job to what I needed :) still frustrating though!
  • 3
    @JerreMuesli pekac?
  • 2
    Let the war begin :)
  • 5
    @Darkler
    Probably meant PEBCAK.Problem exists between chair and keyboard.
  • 3
  • 1
    @Jamoyjamie use guava. ImmutableList.of(...)
  • 2
    The only real reason to hate Java is that there is no easy way around garbage collection when you need it. Otherwise it's a great language and the JVM is a great platform. If you hate the boilerplate, use Kotlin.
Add Comment