Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8254985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:22:45+00:00 2026-06-08T01:22:45+00:00

Enum is Comparable which means you can have NavigableSet<AccessMode> modes = new TreeSet<>(); NavigableMap<AccessMode,

  • 0

Enum is Comparable which means you can have

NavigableSet<AccessMode> modes = new TreeSet<>();
NavigableMap<AccessMode, Object> modeMap = new TreeMap<>();

These have O(ln N) access times.

The Enum collections have O(1) access times, but are not Navigable

NavigableSet<AccessMode> modes = EnumSet.noneOf(AccessMode.class); // doesn't compile
NavigableMap<AccessMode, Object> modeMap = new EnumMap<>(AccessMode.class);  // doesn't compile

I was wondering if there was a reason Enum collections were not Navigable (and Sorted). i.e Am I missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:22:47+00:00Added an answer on June 8, 2026 at 1:22 am

    My best guess is that navigability was not seen as a major use case for enum sets. There is nothing in the implementation that would prevent navigability. The rare use cases that combine the need for a set of enum members with navigability are covered by the TreeSet and TreeMap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

An enum in Java implements the Comparable interface. It would have been nice to
I write a expression that will test if a property(enum) of a object have,
Enum is basically a special class type, and can have methods and fields just
Enum is in the java.lang.Enum , and Object is in the java.lang.Object . So,
enum color = {blue, black=3, yellow=3}; 2 colors have the value 3, is it
public enum ProcessorFactory { A(ap) { Processor create() throws Exception { return new AProcessor();
With enum under .net the biggest number you can use is ULong. This mean
Have enum with inner fields, kind of map. Now I need to get enum
I have three enums, which - in combination - should identify a unique state
public enum myEnum { VAL1(10), VAL2(20), VAL3(hai) { public Object getValue() { return this.strVal;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.