title: Java - Collectors.groupingBy - the last 15 days
body: <p>is it possible to group by the last 15 days using Java's <code>Collectors.groupingBy</code>?</p>
  <p><strong>Input:</strong></p>
  <pre><code>public class Tweet { 
  
   String id;
   LocalDate createdAt; 
  
   // Constructor Ignored
  
   List&lt;Tweet&gt; tweets = new ArrayList(){{
    add(new Tweet(&quot;1&quot;, &quot;2021-11-17&quot;));
    add(new Tweet(&quot;2&quot;, &quot;2021-11-16&quot;));
    add(new Tweet(&quot;3&quot;, &quot;2021-11-14&quot;));
    add(new Tweet(&quot;4&quot;, &quot;2021-11-13&quot;));
    add(new Tweet(&quot;5&quot;, &quot;2021-11-12&quot;));
    add(new Tweet(&quot;7&quot;, &quot;2021-10-09&quot;));
    add(new Tweet(&quot;8&quot;, &quot;2021-10-08&quot;));
    add(new Tweet(&quot;9&quot;, &quot;2021-10-07&quot;));
    add(new Tweet(&quot;10&quot;, &quot;2021-09-02&quot;));
    add(new Tweet(&quot;11&quot;, &quot;2021-09-01&quot;));
   ...
  
   }};
  
  }
  </code></pre>
  <p><strong>Expected Output:</strong></p>
  <pre><code>2021-11-17:  (group must include 2021-11-17 + 15 days before 17th)
   Tweet(&quot;1&quot;, &quot;2021-11-17&quot;);
   Tweet(&quot;2&quot;, &quot;2021-11-16&quot;);
   Tweet(&quot;3&quot;, &quot;2021-11-14&quot;);
   Tweet(&quot;4&quot;, &quot;2021-11-13&quot;);
   Tweet(&quot;5&quot;, &quot;2021-11-12&quot;);
  
  2021-10-09: (group to include 2021-10-09 + 15 days before 9th)
   Tweet(&quot;7&quot;, &quot;2021-10-09&quot;);
   Tweet(&quot;8&quot;, &quot;2021-10-08&quot;);
   Tweet(&quot;9&quot;, &quot;2021-10-07&quot;);
  
  2021-09-01: (group to include 2021-09-01 + 15 days before 1st)
  Tweet(&quot;10&quot;, &quot;2021-09-02&quot;);
  Tweet(&quot;11&quot;, &quot;2021-09-01&quot;);
  
  </code></pre>
  <p>Current logic (<strong>Not working</strong>):</p>
  <p><strong>Main Method:</strong></p>
  <pre class="lang-java prettyprint-override"><code>
  TemporalAdjusters adjuster = TemporalAdjusters.ofDateAdjuster(d -&gt; d.minusDays(15));
  
  Map&lt;LocalDate, List&lt;Tweets&gt;&gt; groupByLast15Days = tweets.stream()
                  .collect(Collectors.groupingBy(item -&gt; item.createdAt())
                    .with(adjuster)));
  
  System.out.println(groupByLast15Days);  // provides incorrect results
  </code></pre>
  <p>any help is massively appreciated! Thanks!</p>