From charlesreid1

Revision as of 04:21, 6 June 2017 by Admin (talk | contribs) (Created page with "An enumeration of the things I don't like about Java. ==typing in general== Not necessarily Java-specific, but using a typed language is like wearing a stuffy outfit with a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

An enumeration of the things I don't like about Java.

typing in general

Not necessarily Java-specific, but using a typed language is like wearing a stuffy outfit with a too-tight collar - the compiler.

generic object templating

Trying to do one of the simplest operations imaginable: given a set of integers, find a duplicate.

To implement one of the solutions, you have to take the integers passed in and use them to access another array.

Oh, no. Java will have none of that.

  • Problems begin with just the very act of initializing data. This is your first warning.
  • Can we do `Arrays.asList(1,2,3,3)`? Nope.
  • Also, we can use generics `<T>`, but not in a static context.
  • Also, we can define static methods that take a generic type `<T>`. But no arrays `T[]`.
  • To way to initialize an all-zeros list of Integers.
  • No way to convert any primitive types to wrappers in one go.
  • No way to convert from PT int[] to Object type Integer[]