title: What is the diamond operator in Java?
body: <p>I have an arraylist with type patient_class and the arraylist type has been underlined in yellow and the IDE has mentioned "redundant type arguments in new expression (use diamond operator instead)".</p>
  
  <p>My problem is: Should I use the diamond operator instead? Is it a must? Will I get any data loss or any other problem when storing records to the arraylist?</p>
  
  <p>Here is my arraylist:</p>
  
  <pre><code>public class Register_newpatient extends javax.swing.JFrame {
  
      public Register_newpatient() {
          initComponents();
          groupbutton();
      }
  
      public void groupbutton()
      {
          ButtonGroup bg1=new ButtonGroup();
  
          bg1.add(rbopd);
          bg1.add(rbinpatientcare);
          bg1.add(rbboth);
      }
  
      all_error_handling checkerror = new all_error_handling();
      JFrame frame = new JFrame();
      static ArrayList&lt;patient_class&gt;patientlist = new ArrayList&lt;patient_class&gt;();
  </code></pre>
  
  <p>To be honest I have no idea what a diamond operator actually is.</p>