I wonder if there is ONE universal JAVA function to MIX these essentially the same 4 for the loop in
Additional arguments:
public static <E> void loopA(E... list) {
String str="";
for (E val : list) {
str+= val.toString();
}
}
Array Type E:
public static <E> void loopB(E[] list) {
String str="";
for (E val : list) {
str+= val.toString();
}
}
Set Collection Type E:
public static <E> void loopC(Set<E> list) {
String str="";
for (E val : list) {
str+= val.toString();
}
}
List collection type E:
public static <E> void loopD(List<E> list) {
String str="";
for (E val : list) {
str+= val.toString();
}
}
ABOVE 4 in ONE of this:
public static <E> void loopSigma(...){
String str="";
for (E val : list) {
str+= val.toString();
}
}
source
share