title: Check whether list of custom objects have same value for a property in Java 8
body: <p>I am new to Java 8. I have a list of custom objects of type A, where A is like below:</p>
  
  <pre><code> class A {
        int id;
        String name;
   }
  </code></pre>
  
  <p>I would like to determine if all the objects in that list have same name. I can do it by iterating over the list and capturing previous and current value of names. In that context, I found <a href="https://stackoverflow.com/questions/31808779/how-to-count-number-of-custom-objects-in-list-which-have-same-value-for-one-of-i">How to count number of custom objects in list which have same value for one of its attribute</a>.  But is there any better way to do the same in java 8 using stream?</p>