I have a pretty simple question, but i can't manage to find the correct answer.
So in my project i have an abstract class "JmjrstPlugin", from which some other plugins inherit. I'm using javas ServiceLoader to find all of the plugin classes like followed:
public static Iterable<JmjrstPlugin> getPlugins() {
return ServiceLoader.load(JmjrstPlugin.class);
}
To my question: Is the Iterable Object i recieve from this function oredered. (The JmjrstPlugin implements the Comparable interface and has a working compareTo method).
PS: the project is currently in a state which makes it impossible for me to test it right now.
Javadoc of ServiceLoader
says:
The only requirement enforced by this facility is that provider classes must have a zero-argument constructor so that they can be instantiated during loading.
That means it doesn't care whether your implementation classes implement Comparable
, or not.
Also, a Set
is generally an unordered collection, unless explicitly specified otherwise. The javadoc doesn't specify, so it is unordered.