How to Split java.util.Set object into multiple objects?

Hi All,
I'm having a collection of items in a Set. Assume that i'm having 10,000 items in Set A.
Now i like to split the Set into multiple Set or Array such as each set or array consist of 100 records. i.e whenever
i get more items i want to split them into mutiple set or array.
Is there is any Java Api doesn't this function? or any other way to achieve this?
Thanks,
J.Kathir

Iterate through them, placing them into different new collections.
It may be easier to add the Set to a List, and then call sublist() a few times on the resulting List.

Similar Messages

  • How to Store java.util.Map object using JPA

    Hi
    I have a cache where the underlying object is just a map (HashMap for example).
    I'd like to create a JPA backing store for this cache.
    Is there a way to do that, or can JPA only store objects that are JPA annotated?
    Thanks
    Edited by: mesocyclone on Dec 11, 2008 4:22 PM

    Hi,
    I believe that the objects that the Map contains would need to be JPA annotated.
    --Tom                                                                                                                                                                                               

  • Getting compilation error: java.util.Set is an interface. This interface is not supported.

    Hi Folks,
    Is there a limitation in BEA's web services implementation? I have a simple web
    service that returns an array of java objects. However I am calling another middle
    tier API that returns a Set. I convert this Set into array of object and return
    it via the web service.
    However the .jws file that implements the webservice does not compile. I get the
    following error message:
    java.util.Set is an interface. This interface is not supported.
    Is there a limitation on using Collections within the .jws file? If that is the
    case it is a severe limitation.
    Note my Web Service API returns an array of java objects with no collections in
    them.
    Sanjay

    Hello,
    Generic java collections can only be handled in a very generic, weakly
    typed manner.
    Take a look at the
    http://workshop.bea.com/xmlbeans/guide/conXMLBeansSupportBuiltInSchemaTypes.html
    and also
    http://workshop.bea.com/xmlbeans/guide/conJavaTypesGeneratedFromUserDerived.html
    You might also ask your question to the XMLBeans newsgroup:
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.xmlbeans
    Regards,
    Bruce
    Sanjay wrote:
    >
    Hi Folks,
    Is there a limitation in BEA's web services implementation? I have a simple web
    service that returns an array of java objects. However I am calling another middle
    tier API that returns a Set. I convert this Set into array of object and return
    it via the web service.
    However the .jws file that implements the webservice does not compile. I get the
    following error message:
    java.util.Set is an interface. This interface is not supported.
    Is there a limitation on using Collections within the .jws file? If that is the
    case it is a severe limitation.
    Note my Web Service API returns an array of java objects with no collections in
    them.
    Sanjay

  • Puzzled by the redefinition of the methods in java.util.Set

    Hi all,
    I don't understand why those methods in java.util.Set redefined since their counterparts have alrealdy been defined in java.util.Collection and java.util.Set extends java.util.Collection. I agree to redefine boolean add(Object o) because its contract has been modified, but what about the rest like
    size() and iterator() ?
    Thanks.

    Hi all,
    I don't understand why those methods in
    in java.util.Set redefined since their counterparts
    have alrealdy been defined in java.util.Collection
    and java.util.Set extends java.util.Collection. I
    agree to redefine boolean add(Object o) because its
    contract has been modified, but what about the rest
    like
    size() and iterator() ?Completeness's sake?
    ~Cheers

  • ADF Faces af:table support java.util.Set

    I was using a java.util.Set in my model classes, as implementation of the Collection interface. And wanted to show the Set using a <af:table> after a while I discoverded that the documentation did not mention support of java.util.Set, only List.
    Now I have to convert my collection to List in the backing beans of my view.
    Is there a better approch than converting every Set in the view using
    new Arraylist(set)?
    And what is the reason of the missing Set support (or General Colelction support)?
    Thank you

    Deepak, I don't think you know what you're writing about.
    No, we do not support java.util.Set in <af:table>. For that matter, neither does <h:dataTable>.
    The "why" of it is that we require indexed access into the table for operations like "Display rows 526-550". java.util.Set does not offer indexed access.
    By the way, one corollary - do not use java.util.LinkedList with tables (ADF Faces or the JSF data table). If the list is small, then it won't be a problem, but with a large list, you'll get brutal performance.

  • In iPhoto 11, I know how to create new libraries.  I do not know how to split my existing large library into the new ones.

    In iPhoto 11, I know how to create new libraries.  I do not know how to split my large existing library into the new libraries?

    You need to use the iPhoto Library Manager.
    (66928)

  • Does anyone know how to reload Java SE 6 back into Lion until Apple and Oracle get it together?

    Does anyone know how to reload Java SE 6 back into Lion until Apple and Oracle get it together?

    See the following, with all of its caveats:
    http://managingosx.wordpress.com/2013/01/31/disabled-java-plugins-xprotect-updat er/
    For what it's worth, I am not using this method, nor am I re-enabling Java until Oracle comes out with a fix. I also won't be available to advise you on troubleshooting this method.

  • Failed to unmarshal interface java.util.Set

    I am trying to get all mbeans using getAllMBeans() method after
    getting MBeanHome successfully. The method fails with the following
    error.
    Any clues ?
    Thanks
    karthik
    >>>>
    weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception -
    with nested exception:
    [java.rmi.UnmarshalException: failed to unmarshal interface
    java.util.Set; nested exception is:
         java.io.InvalidClassException: javax.management.MBeanAttributeInfo;
    local class incompatible: stream classdesc serialVersionUID =
    7043855487133450673, local class serialVersionUID =
    8644704819898565848]
         at weblogic.management.internal.AdminMBeanHomeImpl_WLStub.getAllMBeans(Unknown
    Source)

    I am trying to get all mbeans using getAllMBeans() method after
    getting MBeanHome successfully. The method fails with the following
    error.
    Any clues ?
    Thanks
    karthik
    >>>>
    weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception -
    with nested exception:
    [java.rmi.UnmarshalException: failed to unmarshal interface
    java.util.Set; nested exception is:
         java.io.InvalidClassException: javax.management.MBeanAttributeInfo;
    local class incompatible: stream classdesc serialVersionUID =
    7043855487133450673, local class serialVersionUID =
    8644704819898565848]
         at weblogic.management.internal.AdminMBeanHomeImpl_WLStub.getAllMBeans(Unknown
    Source)

  • TestNG with java.util.Set

    hi, i want to test simple method:
    @Parameters({"lista"})
    @Test
    public GroupedFiles groupFiles(Set<File> p_files){
    }and i have definition of my xml:
    <suite name="My suite">
      <parameter name="first-name"  value="Cedric"/>
      <test name="Simple example">
      <-- ... -->and my testNG throws me uknown for me exception:
    java.lang.AssertionError: Unsupported type parameter : interface java.util.Set
    could anyone help me with this case, thanks for any knowledge

    'little code modification'
    hi, i want to test simple method:
    @Parameters({"lista"})
    @Test
    public GroupedFiles groupFiles(Set<File> p_files){
    }and i have definition of my xml:
    <suite name="My suite">
      <parameter name="lista"  value="java.util.Set"/>
      <test name="Simple example">
      <-- ... -->and my testNG throws me uknown for me exception:
    java.lang.AssertionError: Unsupported type parameter : interface java.util.Set
    could anyone help me with this case, thanks for any knowledge

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • Can not create WebService with java.util.Locale object why?

    I am unable to create a WebService which contains a Locale Object in the request.  I assume its because the java.util.Locale object is not Serializable.  Can anyone tell me if there is a work around for this?

    Hi,
    Make sure your strings for Locale follow these rules...
    The language string should be lower-case, two-letter codes as defined by ISO-639.
    http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
    The country string should be upper-case, two-letter codes as defined by ISO-3166.
    http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
    Or try with some constant Locales like
    Locale.CANADA
    Locale.US
    regards,
    Uma

  • How can I turn a recorded voice into multiple voices that sound like a group of singers?

    I'm using Logic Pro 9. Could someone teach me how to turn a single recorded voice into multiple voices that sound like a group singing together
    by mixing or other techniques ? I don't have the luxury of a group singing together with me when I do recording. Advices would be much appreciated!

    By far the most natural way to achieve this is for the singer to perform multiple takes - even if you've only one singer. At it's simplest, you could just double track the vocal part, although I prefer 3 parts - panned centre, left & right. Then repeat this process for each harmony, & mix accordingly.
    Melodyne & some of the above methods do work on am single voice, but phase cancellation can be an issue if your not careful with each part's timing & panning. If you can only get a couple of decent takes from the singer, far better to perform any harmony/pitching techniques on the second take to avoid any phase issues. It's not uncommon for a singer to perform each vocal part 5-10 times, then comp (edit) the best takes so that you end up with 3 decent takes.
    If you've only only one voice to work with Antares Harmony EFX is a useful alternative.
    http://www.antarestech.com/products/harmony_efx.shtml

  • How to split out a set of data????

    package mitsim_converter;
    import java.io.*;                            // For input & output classes
    import java.util.*;                          // For the Date class
    public class testgod {
    public static void ReadCoFile(String Co_inputFile, String Co_dirName, String Co_outputName)
        throws IOException {
        File aFile = new File(Co_dirName, Co_outputName); // Output Directory location and name
         aFile.createNewFile();         // Now create a new file if necessary
         if(!aFile.isFile())             // Verify we have a file
           System.out.println("Creating " + aFile.getPath() + " failed.");
           return;
    BufferedReader in = new BufferedReader(new FileReader(Co_inputFile));
    BufferedWriter out = new BufferedWriter(new FileWriter(aFile.getPath(), true));
    //Variable declarations
         int a = 0;
         int b = 0;
         int c = 0;
         String text;
       while ((text = in.readLine()) != null)  //multiple line reading
          for(int i = 0; i < text.length(); i++)
              char word = text.charAt(i);
                  if ( word == '{')     //search for the ' { ' charecter
                      a++;              //counting ' { '  unit
          for(int i = 0; i < text.length(); i++)
              char word = text.charAt(i);
                  if ( word == '}')     //search for the ' } ' charecter  
                      b++;              //counting ' } '  unit
          if(a == 1)      //print out the 1st line of a set of data
              String[] sentance = text.split(" ");
              System.out.println(sentance[1]+sentance[3]); 
      if(a == b)        // 1 set of data is counted
          a = 0;        //count the next set of data
          b = 0;
          out.write(System.getProperty("line.separator")); //separate a new set of data
        public testgod() {
        public static void main(String[] args)
      throws IOException
    // Coordinate Table     
           String tra_inputFile = "C:/Documents and Settings/seng/Desktop/testfile/trajectory.txt";     
           String tra_dirName = "C:/Documents and Settings/seng/Desktop/testfile";
           String tra_outputName = "trajectory_output.txt";
           ReadCoFile(tra_inputFile, tra_dirName, tra_outputName);
    } currently i have a set of data as below:
    1 {
    6 0 2 1037.9 24.4187 -5.4961e-05 1
    2 {
    1 0 2 1013.5 24.4187 4.99431e-05 1
    4 0 1 1057.5 24.4187 -2.63508e-05 0
    3 130 264 115.7 14.2425 1.48289e-05 0
    2 136 276 464.7 11.6186 -3.46263e-06 1
    3 {
    1 0 2 989.1 24.4187 -5.4961e-05 1
    4 0 1 1033.1 24.4187 2.13329e-05 0
    5 126 256 1241.4 22.7881 0 0
    3 130 264 101.5 14.2426 5.23758e-07 0
    2 136 276 453.1 11.6186 -3.46263e-06 1
    }i wish to split them and take out the 1st column and 3rd column data, but the my coding fail to do it. may i know how do i can solve for this problem?
    PS: the expected output
    6 2
    1 2
    4 1
    3 264
    2 276
    1 2
    4 1
    5 256
    3 264
    2 276

    import java.util.regex.*;
    public class TestParse {
      public static void main(String[] argv) {
        String testInput = "1 {\n" +
          " 6 0 2 1037.9 24.4187 -5.4961e-05 1\n" +
          "}\n" +
          "2 {\n" +
          " 1 0 2 1013.5 24.4187 4.99431e-05 1\n" +
          " 4 0 1 1057.5 24.4187 -2.63508e-05 0\n" +
          " 3 130 264 115.7 14.2425 1.48289e-05 0\n" +
          " 2 136 276 464.7 11.6186 -3.46263e-06 1\n" +
          "}\n" +
          "3 {\n" +
          " 1 0 2 989.1 24.4187 -5.4961e-05 1\n" +
          " 4 0 1 1033.1 24.4187 2.13329e-05 0\n" +
          " 5 126 256 1241.4 22.7881 0 0\n" +
          " 3 130 264 101.5 14.2426 5.23758e-07 0\n" +
          " 2 136 276 453.1 11.6186 -3.46263e-06 1\n" +
          "}\n";
        Pattern outer =
          Pattern.compile("\\s*(\\d+)\\s*\\{([\\s\\d\\.\\-\\+e]+)\\}");
        Pattern inner = Pattern.compile("LEFT AS EXERCISE");
        Matcher m = outer.matcher(testInput);
        while(m.find()) {
          if (m.groupCount() != 2) {
            System.err.println("Error: found wrong number of groups: " + m.groupCount());
          } else {
            System.out.print("Time: " + m.group(1) + " " + m.group(2));
            Matcher m2 = inner.matcher(m.group(2));
            while(m2.find()) {
              if (m2.groupCount() != 7) {
                System.err.println("Error: found wrong number of groups: " + m2.groupCount());
              } else {
                int i = 0;
                String iDString = m2.group(++i);
                String segmentString = m2.group(++i);
                String laneString = m2.group(++i);
                String positionString = m2.group(++i);
                String speedString = m2.group(++i);
                String accelerationString = m2.group(++i);
                String vehicleTypeString = m2.group(++i);
                System.out.println(
                  "ID: " + iDString + "\n" +
                  "Segment: " + segmentString + "\n" +
                  "Lane: " + laneString + "\n" +
                  "Position: " + positionString + "\n" +
                  "Speed: " + speedString + "\n" +
                  "Acceleration: " + accelerationString + "\n" +
                  "VehicleType: " + vehicleTypeString);
    }

  • Comparing java.util.Date objects...

    Hi,
    I got a problem using the follwing code:
    // get current date
    Date currentDate = new Date();
    // first check if column 'Date Actions Plan' has a valid value
    if (dl.getDate("actionsplanneddate", i) instanceof Date) {
    // then check if current date is after 'Date Actions Plan'
    if (currentDate.compareTo(dl.getDate("actionsplanneddate", i)) > 0) {
    I'd like to compare two Date objects - the first one is the current date and the second one is from a database column. The Date object of the database column has the following format (for example):
    2004-08-23 00:00:00
    The important thing is just the date (hours, minutes and seconds are not important in that case - therefore it is 00:00:00).
    I'd like to format the currentDate object in the same manner, which means setting hours, minutes and seconds to 00:00:00, too.
    Best regards
    - Stephan

    Hi,
    I got a problem using the follwing code:
    // get current date
    Date currentDate = new Date();
    // first check if column 'Date Actions Plan' has a
    valid value
    if (dl.getDate("actionsplanneddate", i) instanceof
    Date) {Why the instanceof? How would getDate not return a Date? (I'm assuming this is JDBC.)
    // then check if current date is after 'Date Actions
    Plan'
    if
    (currentDate.compareTo(dl.getDate("actionsplanneddate",
    i)) > 0) {
    I'd like to compare two Date objects - the first one
    is the current date and the second one is from a
    database column. The Date object of the database
    column has the following format (for example):If you have a java.util.Date or a java.sql.Date then it doesn't have format. It just represents an instant in time. Whatever format the DB uses or you used to create the date is not present in the Date object.
    You can use compareTo. I think Date also has before() and after() or isBefore()/isAfter() or something like that. Look at the API.
    Or you could call getTime() and compare the longs. Not sure why you'd want to do this though--I'm sure the other two idioms do this under the covers anyway.
    2004-08-23 00:00:00
    The important thing is just the date (hours, minutes
    and seconds are not important in that case - therefore
    it is 00:00:00).
    I'd like to format the currentDate object in the same
    manner, which means setting hours, minutes and seconds
    to 00:00:00, too.Ah. Well, then just creating a java.sql.Date from your java.util.Date might take care of that for you--I think the time portion is supposed to always be zero. Write some code and try it, but remember, it's GMT based, so you might see a nonzero time component, but it shoud match your TZ offset.
    Otherwise you'll have to use java.util.Calendar (java.util.GregorianCalendar)

  • How to split a parallell-page PDF into single-page PDF

    My situation: I have a few hundred pages of files I made quite a few years ago, optimized for "self-publishing" via the printer. I no longer have any source files (my own bad). These files have 2 pages next to each other in an A4 landscape PDF. I would like to change and combine these files into a US Letter portrait PDF.
    I have browsed earlier, similar threads, most notably the most referred to thread:
    http://forums.adobe.com/message/3331516
    which recommends using Adobe PDF printer. However, as this thread points out, and as I for one have found on my own system (10.8.3), Adobe PDF printer is no longer an option on Mac OS X (version 10.6 and on):
    http://forums.adobe.com/thread/556366
    So the question then is: How do we now split double-page landscape PDFs into single-page portrait PDFs?

    Since at least OSX.5 adobe has removed PDF Printer which was begining to fail it was written in Adobe's altered version of javascript and it was a wonder it was working to begin with They replaced it with an Automator action that's called up through the print Driver.
    Here are the steps for applications other than Acrobat.
    create you doucument. laying it out the way you want it.
    Go to Print menu.
    click and hold the pdf button - a context menu pops up.
    now scan the list of choices and choose Adobe PDF or Adobe Quality PDF (depends on version of OS)
    wait for direction fields to come up and make the desired choices (the first screen is basically job options).
    when asked ask for name either ecept name give or choose name of your choice.
    Browse to desired location for file
    then click save.
    How the PDF is layed out in acrobat is determinedby acrobat. Adobe add an additional Layer on top of the Print Driver. You can by pass it and use the Print Driver but if there is an orientation switch in your docment the page is turned so everything comes out with same edge of Paper
    Oh, look out for a Grand idea Adobe did that even Forest Gump would have left alone.
    If you want to do duplex printing to a PDF with more than one page you won't be able to do so whether you have your printer setup for duplex printing. You can go back and forth from printer setting s to Printer setting toggling off and on til you turn blue in the face. You have to go into the document properties and loo for a command called SIMPLEX printing its on by default and needs to be turned off. Even my cat Boots would be smart enough not to put that in.
    This settinging does not permanently turn off and you have to do with each document you create or resave.

Maybe you are looking for

  • How do I get 2 different 3D positions in one comp?

    Hi, I'm fairly new to making 3d composition, so i began making a comp with only 3d text layers. I've been working on this thing since three days and it's gotten huge, so now I have a problem for the first 30 seconds of the video al the 3d layers are

  • HT202390 In the iTunes U App I have several courses that I wish to unsubscribe. This courses are not present in iTunes on my Macbook. How can I unsubscribe from this courses?

    iPad Mini 2 - iOS 8.1.3 When I've opened iTunes U for the first time it started to synchronise some courses. Some of them are old courses that probably I subscribed from my Mac in the past and that are no more present in my Mac. I've tried to sync iT

  • How to detect USB device drives

    Hi I want to write a program which will detect the drive letter when a usb device is plugged in. i.e., if a usb device is plugged in and the drive letter is "F:", then my program will instantly detect the presense of the device as well as get the dri

  • Camera for portrait apps

    When you create a portrait view app in Siena with a camera control, the image is rotated as is the application was in landscape.   Is there now, or will there be in the future, a way to rotate the control so it displays properly? Thanks. Please remem

  • Camera not focusing

    I've had my passport since Nov 2014. Camera was awesome when I first got. Beautiful clear pictures. After the last update. The focus doesn't work at all. Takes 5 minutes for it to even attempt to focus anything, and forget about any close ups. The fr