Java Java Data Structures Exploring the Java Collection Framework Sets

Christopher Mlalazi
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,300 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 :-)

andren
andren
28,405 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.

Christopher Mlalazi
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,300 Points

Thanks guys, I was noticing in the tutorials that they seem like they are in alphabetical order and it got me curious -now I know better!