Skip to content

Java tutorial

illyfrancis edited this page Jul 18, 2013 · 14 revisions

Stuff I forgotten

  • ListIterator<E>

Dynamic Proxies

Guava

  • old presentation

    • Immutable collections, instead of unmodifirable
      • ImmuatableList, Set, SortedSet, Map, (SortedMap - oneday)
      • immutable vs unmodifiable
        • immutability guarantee, easier to use, faster, less memory
      • E.g.
        • constant set using JDK (11:55)
        • a little better Collections.unmodifiableSet( new LinkedHashSet<Integer>( Arrays.asList(...)));
        • ImmutableSet LUCKY_NUMBERS = ImmutableSet.of(4,8,15...);
          • of() <- java.util.EnumSet pattern (** check it out**)
        • constant map - ImmutableMap<String, Integer> ENG_TO_INT = ImmutableMap.with("four", 4)...build() (15:16)
        • Defensive copies
          • ImmutableSet.copyOf(numbers) (17:10)
        • factories
          • ImmutableSet.of() (== Collections.emptyset ?)
          • ImmutableSet.of(a) (== Collections.singleton?)
          • ImmutableSet.of(a, b, c)
          • ImmutableSet.copyOf(someIterator);
          • ImmutableSet.copyOf(someIterable);
        • static final ImmutableMap<Integer, String> MAP = ImmutableMap.of(1, "one", 2, "two");
        • there should be a builders pattern (check current imp)
      • Don't take nulls!!!

NIO

Concurrent maps

  • Usage of ConcurrentHashMap within Spring service class SO

Clone this wiki locally