Example - Map

I. Task
Map item to a new form while iterating through the collection.

II. Notes

  • Java 7 - getter
  • Java 8
    • map (T -> R)
    • map (Function<T,R>)

III. Java Codes

  • Ex3_1_Map.java
    => retrieve base form of all records that are adv or adj
    • Field 2: category is "adv" or "adj"
    • retrieve Field 5: base form
  • Ex3_2_uSort.java
    => Distinct & sort
  • Ex3_2_uSort.java
    => Sort(Comparator<T>)
    => Sort by category
    => Reversed sort
    => Composed sort

IV. Results