Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Java
(view source)
Revision as of 07:51, 20 April 2022
356 bytes added
,
07:51, 20 April 2022
m
→Different ways to loop lists
Line 3:
Line 3:
===With apt===
===With apt===
<nowiki>sudo apt-add-repository ppa:webupd8team/java
<nowiki>sudo apt-add-repository ppa:webupd8team/java
−
sudo apt-get update
+
sudo apt-get update
−
sudo apt-get install oracle-java8-installer</nowiki>
+
sudo apt-get install oracle-java8-installer</nowiki>
Also ensure your JAVA_HOME variable has been set to:
Also ensure your JAVA_HOME variable has been set to:
Line 340:
Line 340:
}
}
}
}
+
</syntaxhighlight>with comparators<syntaxhighlight lang="java">
+
class DescendingStudentComparator implements Comparator<Student> {
+
@Override
+
public int compare(Student student1, Student student2){
+
return Integer.compare(student1.getId(), student2.getId());
+
}
+
}
+
+
Collections.sort(studentsArrayList, new DescendingStudentComparator());
</syntaxhighlight><br />
</syntaxhighlight><br />
==Classes and Objects==
==Classes and Objects==
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version