Java Java Data Structures Exploring the Java Collection Framework Sets

Christopher Mlalazi
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,301 Points

Imports == Alphabetical order?

I have just noticed that all imports seem to be in alphabetical order is this a must?

import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

3 Answers

Nope :-)

28,464 Points

No it is not. The order is entirely up to you. The only must when it come to import statements is that they have to be placed at the top of the file, or directly below the package statement if there is one. Other than that you are free to place them as you wish.