arraylist - find highest of each type from Map in java -


I am creating the object's ArrayList, I use different constructors of that class to include the information , But I have a type of variable I update with every manufacturer call here What I'm doing here

  public class eProperty {public string type = zero; Public integer digits; Public int code; Public string category public string student_name = null; Public string employee_name = null; Public string o_name = null; Public e-property (string type, string student_name, int mark) {this.marks = marks; This.Type = type; This.student_name = student_marks; } Public e-property (string type, string worker_name, inte-makers, string category) {this.marks = marks; This.Type = type; This.employee_name = employee_name; This.category = category; } Public eProperty (string type, int code, int makers, string o_NA) {this.marks = marks; This.Type = type; This.mnc = Code; This.o_name = o_name; }}  

I populate the arraylist like this,

  ArrayList & lt; EProperty & gt; all data; EProperty data; If (type.equals ("Student")) {data = new eProperty (type, "John", 45) allData.add (data)} if (type.equals ("employee")) {data = new eProperty (type , "Wiki", 86, "Developer") allData.add (data)} ... other matters also handled in this way  

Now I return the highest score for each type I want to take the

using the loop (sorry for this .. ..) and Predicate to

  public static int hoggamebackback type (arrelisted & lt; eProperty & gt; all data, string ta Ipe) {valid predicate = new predicate () {public boolean evaluation (object data) {if ((eProperty) data) .getType () Equal (type)) {back true; } Other {return false; }}}; ArrayList & LT; EProperty & gt; FilteredData = (Arrayist & lt; eProperty & gt;) Collection available. Selection (all data, forecast); Int maxmarks = 0; (Property Data: Filtered Data) {if (data.getMarks ()> Max Marks) {maxMarks = data.getMark (); }} Return Maximum Marks; }  

Comments