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 8333853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:09:39+00:00 2026-06-09T03:09:39+00:00

I have the following example: import java.util.EnumSet; import java.util.Iterator; public class SizeSet { public

  • 0

I have the following example:

import java.util.EnumSet;
import java.util.Iterator;

public class SizeSet {

    public static void main(String[] args) {
        EnumSet largeSize = EnumSet.of(Size.XL,Size.XXL,Size.XXXL);
        for(Iterator it = largeSize.iterator();it.hasNext();){
            Size size = (Size)it.next();
            System.out.println(size);
        }
    }
}


enum Size {
  S, M, L, XL, XXL, XXXL;

}

In this code I can understand that the Enum creates an Enum type of Sizes.

My question is: is largeSize an object of EnumSet type? What does it really mean? I really want to understand it better.

  • 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-09T03:09:40+00:00Added an answer on June 9, 2026 at 3:09 am

    As for any variable, its type is found in its declaration:

    EnumSet largeSize
    

    So yes, largeSize (which should be named largeSizes since it’s a collection) is of type EnumSet. It should also be generified, and thus be declared as

    EnumSet<Size> largeSizes
    

    What it means, is that largeSizes is of type EnumSet. An EnumSet is a Set which contains enum instance of a specific enum type, in a more efficient way than other Set implementations (like HashSet, TreeSet, etc.). To know what an EnumSet is, read its API.

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

Sidebar

Related Questions

I have following code: import java.io.*; import java.util.concurrent.* ; public class Example{ public static
I have the following example: package cage; import java.util.HashSet; import java.util.Set; import animals.Animal; public
Example: For(int i=0; i<4; i++) playSound(Sound.wav); I have the following classes: Main import java.io.IOException;
import java.util.*; public class PossibilityGame { private List<String> list1, list2, list3, list4; public PossibilityGame()
I have three java types as defined below: Main.java: import java.util.Arrays; import java.util.List; public
I have the following code: package example; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JFrame; import
I have create following java file,compile it and got .class file. import java.io.*; import
I have the following example, compiled in VS2005, warning level 4: int main(int argc,
I have following method in my class which extends JTable: protected void setTableCursor(Cursor cursor)
The following code is based on the example given in the javadocs for java.util.zip.Deflater

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.