Didn't know one could set ownerName from default constructor using: ownerName= name.toString(); but apparently overriding toString method to one like this: public String toString(){ return this.ownerName; } does the work. That was one more interesting thing learnt along learning how the HashMap works. Thanks.
Here is solution for first question... Thanks very much for your kind video its very helpful..... import java.util.Comparator; public class CustomComparator implements Comparator { @Override public int compare(Employee o1, Employee o2) { // TODO Auto-generated method stub /*System.out.println("entered"); System.out.println(o1.getEmpName().compareTo(o2.getEmpName())); int result = o1.getEmpName().compareTo(o2.getEmpName()); if(result>0) return -1; else if(result < 1) return 1; return 0; }*/ if(o1.getEmpid()%2==0 && o2.getEmpid()%2!=0) { return -1; } else if(o1.getEmpid()%2!=0 && o2.getEmpid()%2==0) { return 1; } return 0;
Your "download link " does not work.
Didn't know one could set ownerName from default constructor using:
ownerName= name.toString();
but apparently overriding toString method to one like this:
public String toString(){
return this.ownerName;
}
does the work. That was one more interesting thing learnt along learning how the HashMap works. Thanks.
Here is solution for first question... Thanks very much for your kind video its very helpful.....
import java.util.Comparator;
public class CustomComparator implements Comparator {
@Override
public int compare(Employee o1, Employee o2) {
// TODO Auto-generated method stub
/*System.out.println("entered");
System.out.println(o1.getEmpName().compareTo(o2.getEmpName()));
int result = o1.getEmpName().compareTo(o2.getEmpName());
if(result>0)
return -1;
else if(result < 1)
return 1;
return 0;
}*/
if(o1.getEmpid()%2==0 && o2.getEmpid()%2!=0)
{
return -1;
}
else if(o1.getEmpid()%2!=0 && o2.getEmpid()%2==0)
{
return 1;
}
return 0;
}
}
Hi which tool you are using for create this animation?
+Aditya Bhardwaj animatecc
+java9s Thanks Sir you are so Kind .God Bless you.
+Aditya Bhardwaj Animatecc is free or paid??
+Aditya Bhardwaj it is from Adobe. It is paid
Nice tutorial