title: How to use Java 8 Collectors groupingBy to get a Map with a Map of the collection?
body: <p>Imagine these classes</p>
  
  <pre><code>class Subject {
     private int id;
     private Type type;
     private String origin;
     private String name;
  
     Subject(int id, Type type, String origin, String name) {
        this.id = id;
        this.type = type;
        this.origin = origin;
        this.name = name;
     }
  
     // Getters and Setters
  }
  
  enum Type {
     TYPE1,
     TYPE2
  }
  </code></pre>
  
  <p>I have a list of those Subject classes</p>
  
  <pre><code>List&lt;Subject&gt; subjects = Arrays.asList(
      new Subject(1, Type.TYPE1, "South", "Oscar"),
      new Subject(2, Type.TYPE2, "South", "Robert"),
      new Subject(3, Type.TYPE2, "North", "Dan"),
      new Subject(4, Type.TYPE2, "South", "Gary"));
  </code></pre>
  
  <p>I would like to get as a result of using <code>Collectors.groupingBy()</code> a Map grouping first the <code>Subject</code> objects by <code>Subject.origin</code> and then grouped by <code>Subject.type</code></p>
  
  <p>Getting as a result an object like this <code>Map&lt;String, Map&lt;Type, List&lt;Subject&gt;&gt;&gt;</code></p>