How to make a Collection out of a Collection?

I don't want to get into the specifics of my problem since I don't think they are needed.
Anyways, Say I have a Collection of ArrayLists and I want to create a Collection of their size()'s - how would I do that? I found a way to do it but its very messy:
// Assuming lists is a Collection of ArrayLists
Iterator i = lists.iterator();
HashMap tempMap = new HashMap();
// loop through each ArrayList
while( i.hasNext() ) {
     ArrayList currentList = (ArrayList) i.next();
// Add the ArrayList as the key and the size as the value (in Integer form)
// I suppose that anything would work for the keys as long as they are unique
     tempMap.put( currentList, new Integer (currentList.size() ) );
// returns a Collection of size()'s for the ArrayLists
return tempMap.values();Hope I was clear enough - its difficult to describe my problem. I just would like an easier way to do this.
Thanks ;)

There isn't really an easier way. You could use
another array list rather than a hashmap in your
construction.
But at the end of the day, you have to iterate
through all your items, call get size and add them to
your list
Collection listSizes = new ArrayList();
for (Iterator it = lists.iterator; it.hasNext(); ){
Collection c = (Collection)it.next();
c.add(new Integer(c.size()));
return listSizes;
Neanderthals.
Collection<Integer> listSizes = new ArrayList<Integer>();
for (Collection c : lists)
  listSizes.add(c.size());
return listSizes;

Similar Messages

  • How to make a snapshot out of a movie file?

    How to make a snapshot out of a movie file and integrate this snapshot into the movie? Thanks, Wolfgang

    Either you use the Hold function from the Retiming popup or you export an image and reimport it.

  • How to make a key out of this data?

    Since no one replied to my last post, I'll give it another try. From an RTSP server I get two values, a key called rsaaeskey (342 bytes, without the line breaks):
      yxKBocBgTii20n9nbKfYGyGhPqtosXuq8M99yU5/PzTVNmIUsUGlpD27u
      cqN8eNFvmaO7cFVXeaMGaCfI5V+YNrd77xGQ+CUE0XFraXUvp4cF4aX1L
      ZOGe38nwX3Ba+4bQFfjmYgz3ObRuOWlw9KCi4CMP5574F+CIvutVAwtAC
      PiDFF7nVcoaBTr2QbSUile0Zs3Hyxjn9PWVaey9Nu2DgJZ8rtw6F2SkQ7
      NDHBjjUKXNIeCAeBFuV4XNiazvi3gWa4VbgITtD9jcm+7nPMAK0oBL1S3
      K3Z6FK7XVnfehYYJjRw7THMZzSvq7FtLB9QgulqQTJ3awJdwS0ACb1FkAand an initialization vector called aesiv (22 bytes):
      zcZmAZtqh7uGcEwPXk0QeAThe data is obviously Base64 encoded. However, after decoding I don't know how to make a key out of it. Trying KeyFactory's generatePublic and generatePrivate methods result in an InvalidKeySpecException with any algorithm I've tried (RSA, DSA, DH).
    I think this is a multi-prime RAS secret key (someone said they're 342 bytes long), but how do I generate a Java Key out of it?

    The rsaaeskey, decoded to binary, is a binary array of 256 bytes. Using the DUMPASN1 tool we see that the bytes are not in ASN.1 BER or DER encoding.
    C> openssl enc -base64 -d -in rsaaeskey.base64 -out test.bin
    C> dumpasn1 rsaaeskey.bin
       0 CB   18: [PRIVATE 11]
                :   81 A1 C0 60 4E 28 B6 D2 7F 67 6C A7 D8 1B 21 A1
                :   3E ABIf it were encoded in ASN.1 BER or DER encoding it will start as a "SEQUENCE" or a "SET", not as an unrecognized data.
    You need to check the exact specification of the protocol. (Are you using TSP - RFC 3161, or RTSP - RFC 2326?)

  • How to make a stationery out of .doc or .docx file?

    Hi,
    I stumbled upon a website that has some nice stationery, in .doc format. and since there few free pre made stationery available for Mail.app, at least to my knowledge, because I think I almost downloaded every free stationery available out there that could be easily found via Google. I decided to download some of these .doc stationeries and try to put them in Mail.app, but first I had to convert them into .html format. so here is what I've already tried and did not work:
    first I tried opening them in TextEdit, which supports .doc out of the box, only to find out that the pictures in the documents are gone to thin air. I tried saving it and then opening it with something else like Open Office, but the pictures were permanently gone.
    then I tried opening the original documents directly in Open Office, you guessed right If you said they will look screwed, and they were, and tried to save them as html, they were screwed even more.
    so I did a bit of research and found out that I could use Google Docs in order to convert the documents, I uploaded them into my Google docs and then tried to open them with it, but found it that Google docs can't handle the pictures (specially background pictures) either. as a result I did more searching to find a document converter and here is what I found:
    I found a few online service to convert these documents:
    http://www.freefileconvert.com/ was pretty good to convert the files into an .odt format. at first I thought yes I got the solution, now I can simply convert it to html using Open Office, but unfortunately, when I saved the document in html format and checked it in Safari to see how does it look, as If I would have done the same in MS Office with the original format, it looked pretty much screwed .
    So I continued to look and I found a few other online services one of them asked me to pay a fee, I skipped to the other one which was http://docx-converter.com/. unfortunately the website wasn't functioning properly I think, at least for me (maybe someone out there has succeeded using it, I don't know.) and it didn't send me anything.
    Finally I found http://www.zamzar.com/ that could convert .doc or .docx documents into html, or at least that is what it claims to do so, I tried it, and after I received the file via email, I found out it only contains a bmp image of the document's background. So much for the online conversion services!
    But I decided I would give it a last shot using MS Office online, so I opened up my old Windows Live mail and went into my Skydrive, I uploaded the documents and tried saving it as html, but there were no save as html (after all an online copy of MS Office should have some limitations, otherwise few people will be willing to buy a Desktop version) but this didn't made me disappointed, since I already knew, that Neither Office Word can make a clear conversion, so I tried something different, while I was in Safari looking at the document in online MS office, I saved the page as Web Archives, then I opened the file with TextEdit, and after deleting useless links and pictures, I finally managed to get a clear document with everything that supposed to be in it. At this point I only need to know how to make use of this document to create a stationery with this raw file which is in Web Archive format. any ideas?
    null

    I'm a total idiot! How did I overlook http://www.zamzar.com/ functions? I think I might have mistakenly chosen convert to BMP instead of html. I tried it and the result was very good.
    OK I finally found a good solution for this problem, so everyone out there that has the same problem, here is what I did:
    1. OK if you have some .doc and .docx file formats and you want to convert them into something like .html or .odt, without having to reedit the code or getting a screwed document, use http://www.freefileconvert.com/ in order to convert them into .odt so they would look as they do in MS office just go to the website and upload your documents then choose .odt, then click convert, after a few moments you will get a link to download your .odt files. you can use and play around with your document in Open Office, I have tested it and it's really good.
    2. Or if you want to convert them into .html with a clean code, and all the elements in it, simply go to http://www.zamzar.com/ and then ulpoad your documents, choose .html and enter your email address, you will have your .html files zipped and sent right in your inbox, then you could use Kompozer like me, or any other html editor, to make a template out of it. I tried it and the result was nice, now I have a bunch of nice html files that I can use to make templates and email stationery.

  • Video Answer to "How to make 3D Video out of regular 2D Video"

    Didn't know how to do that and asked here this question 2 month ago - Is it possible to make 3D video out of regular 2D video file to watch further on my iPod. So I came across an answer to this on ...Youtube!
    Here are two video screencasts I found to progs that can do such thing, So I've tried and now enjoy my movies in 3D on iPod.
    If you're interested then deffo check them out:
    http://www.youtube.com/watch?v=lUYT-c5leSU
    http://www.youtube.com/watch?v=_TxRMGUwGS0

    follow advice given in this User Tip
                     How can I make a still frame from iMovie 11? (also works in iMovie 10)

  • How to make a collection based on successful application deployment?

    Hi,
    Does anyone know how I can make a collection from where the members are all the computers that have successfully installed a particular application.
    I saw this query from another site but i'm having a problem finding the assignmentID for the application I deployed.
    select SMS_R_System.ResourceId from  SMS_R_System inner join SMS_AppDeploymentAssetDetails on SMS_AppDeploymentAssetDetails.MachineID = SMS_R_System.ResourceId where SMS_AppDeploymentAssetDetails.AssignmentID = “16777222″ and SMS_AppDeploymentAssetDetails.StatusType
    = “5″
    Can someone also point me on where I can find the assignmentID for an application?

    Why do you want to do that? Just explain what you are trying to achieve.
    Torsten Meringer | http://www.mssccmfaq.de
    Hi Torsten,
    I wanted to create a collection that will contain the computers which have succeeded an application deployment. So then I can have a list of it. Vice versa, I wanted a list of those that failed. I know that I can do that by replacing the status type to what
    ever corresponds Error or Fail. It just so happen that I can't find the assignmentID.
    Another issue that I'm facing is that my reporting node is not working. I'm currently working on it but I have to get the list of successful/failed application deployment as soon as possible. That's why I though of creating a collection containing only those
    computers.

  • How to make a gif out of a movie clip?

    So yeah... I'm an idiot when it comes to these things.
    How do I go about doing a gif of a small video?
    And... Could you do the explanation in a step by step guide please. Thanks

    Video to GIF | free Video to GIF Generator on Make A GIF
    Animated GIF Generator - Imgflip
    How to Make an Animated GIF from a Video in Photoshop CS5
    The Complete Guide to Making Animated GIFs - Lifehacker
    Giflike - Create a gif from YouTube, video or images
    GIF Maker From Videos. Create Awesome Gif Animations ...
    Bloggif : Convert video to animated GIF for free

  • How to make a "Program" out of my .java files?

    I have made a little application that stores a file to disk. Is there someway to make a file out of my .java files so it can be run without opening my editor and choosing run?

    sorry I didn't check that, I can now run the jar command.
    But even though I can create a .jar file I get an error. I have followed the guide that says I need to add the applications Entry point.
    I have two classes:
    saveDates.class //contains the main method
    UserInput.claa // Parsing of user input
    When I create the jar file I type:
    jar cfe saveDates.jar SaveDates SaveDates.class UserInput.class
    But when I try to run it like:
    java -jar saveDates.jar
    I get the error:
    C:\workspace\dato>java -jar saveDates.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: SaveDates$1
    at SaveDates.main(SaveDates.java:89)
    C:\workspace\dato>
    Do I need to change the main method someway?

  • How to make a fly-out menu item checked?

    Hi,
    is there a way to make a fly-out menu item (coming from an XML list) checked - like in this example:
    by the way, I know it's been submitted as a bug already, but fyi sub-menu items (2-1 in the following example) don't work as expected:
    var xmlMenu:XML =
        <Menu>
          <MenuItem Id="item_1" Label="Item 1"/>
          <MenuItem Label="Item 2">
            <MenuItem Label="Item 2-1"/>
          <MenuItem/>
          <MenuItem Label="---"/>
          <MenuItem Label="Item 3"/>
         </Menu>;
    Thanks in advance!
    Davide

    If Harbs says nope, it's nope
    At least now I know it. Thanks!
    Davide

  • How to make a Lay-Out

    Hello!
    I am using pages for a few months now, but there is one thing I can't get. If you make a project many people with the newest word have a beautiful lay out. For example with colored lines on each page. I was wondering. How can I get something like that in pages? I have looked at the templates but they don't have them and if I open a template I only see the first 2 pages of the whole template.
    Best regards,
    Cathelijne

    MZ,
    There's no magic in those templates that you buy. You're just paying for the designer's time and talent to do what any similarly talented person could do with Pages, given the time.
    What most users would lack, in addition to the training and experience and "the eye" to produce such nice layouts, is the other graphic software that may have been used to facilitate the creation of the background images/graphics that may also be there. Pages has drawing tools, but they would be inadequate, I would guess, to satisfy a graphic designer doing production work. You might be surprised, though, at what can be achieved with the built-in tools if you have the patience.
    Jerry

  • How to make slide show out of photos

    I have about 60 .jpg's I like to make into a slide presentation. What I would like to be able to do is give a friend/relative a disk and all they would have to do it....well, nothing. I'd like it to open on my image number 1. I would like the image to stay on the screen until it's manually advanced by "clicking" on it or on and "advance" button. It seems like it should probably be easy, but I can't figure it out. I'm not adverse to using third party software. I want the images to be as clear as possible. Am using OS X Maverick with 32 GB of ram.
    Thanks in advance.

    There are many ways to produce slide shows using iPhoto (see this:  http://support.apple.com/kb/PH2423 ), iMovie or iDVD and some limit the number of photos you can use (iDVD has a 99 chapter (slide) limitation).
    If what you want is what I want, namely to be able to use high resolution photos (even 300 dpi tiff files), to pan and zoom individual photos, use a variety of transitions, to add and edit music or commentary, place text exactly where you want it, and to end up with a DVD that looks good on both your Mac and a TV - in other words end up with and end result that does not look like an old fashioned slide show from a projector - you may be interested in how I do it. You don't have to do it my way, but the following may be food for thought!
    Firstly you need proper software to assemble the photos, decide on the duration of each, the transitions you want to use, and how to pan and zoom individual photos where required, and add proper titles. For this I use Photo to Movie. You can read about what it can do on their website:
    http://www.lqgraphics.com/software/phototomovie.php
    (Other users here use the alternative FotoMagico:  http://www.boinx.com/fotomagico/homevspro/ which you may prefer - I have no experience with it.)
    Neither of these are freeware, but are worth the investment if you are going to do a lot of slide shows. Read about them in detail, then decide which one you feel is best suited to your needs.
    Once you have timed and arranged and manipulated the photos to your liking in Photo to Movie, it exports the file to iMovie  as a DV stream. You can add music in Photo to Movie, but I prefer doing this in iMovie where it is easier to edit. You can now further edit the slide show in iMovie just as you would a movie, including adding other video clips, then send it to iDVD 7, or Toast,  for burning.
    You will be pleasantly surprised at how professional the results can be!
    To simply create a slide show in iDVD 7 onwards from images in iPhoto or stored in other places on your hard disk or a connected server, look here:
    http://support.apple.com/kb/HT1089
    Preparing images for iDVD slideshows:
    http://support.apple.com/kb/PH5452

  • How to make JPopupMenu pop out upwards?

    The title is just my problem.I add a JToolBar at BorderLayout.South of a JPanel. A popup menu will shown when I click on one button of my JToolBar. But the low part of JPopupMenu was covered by the taskbar of Windows2000. I want to make my JPopupMenu pop out upwards. How can I?

    Assuming that the popup is triggered by the mouse click and it's screen coordinates (x, y). Since the toolbar is in the southern border, and the popup appears to the right and below from that position "(x, y)". Calculate the width and length of the popup, (say it's 60 pixels wide by 90 pixels long) subrtact the witdth value ,(60) and the length value, (90) from x and y respectively. So as to go something like this:
    private void maybeShowPopup(MouseEvent e) {
         if (e.isPopupTrigger()) {
              int x = e.getX() - 60;
                  int y = e.getY() - 90;
                       popup.show(e.getComponent(), x, y);
    }Or something to that effect. You simply alter the coordinates(x, y) to reposition the popup starting point. I did not test the above code as this is purely a fictional example. Hope this helps. Also if you need help measuring screen pixels here is a cool little program called Calipers that will help. http://www.iconico.com/caliper/

  • Guide - How to make the most out of your sp

    This guide is designed to tell you
    .what you should use for the smallest files with almost floorless results
    2.some suggestions of how to get your files smaller without sacrificing much audio quality
    if you have a flash player, or a hard disk based player and lots of music you want to get the best quality for the least file size. In my opinion a Lame encoded MP3 is probably your best option and if you just want to make your wav files less than a third of the size at a great quality just use 320kb
    ps.
    LAME will give you the best quality for the same amount of space.
    However if you want to have lots of tracks on a small space and still get good quality here are the settings and FREE software you should use.
    Razor Lame - An easy interface for the use of Lame (MP3 Encoder), extract the zip files into a folder
    - http://www.dors.de/razorlame/index.php
    Lame - get the latest lame bundle and add lame.exe to your razor lame folder this will allow razor lame to encode your wav files to MP3 using the latest and greatest version of lame.
    - http://www.rarewares.org/mp3.html
    before I tell you the settings and explain why I have chosen them, if you want to save time you can just paste this (-b 64 -m j -h -V -B 320 --resample 44.) into the custom options bit, this will set up my options without you having to fiddle about, under the expert tab (without the brackets) then tick only use custom options.
    The settings - in the lame options do this.... choose MODE as Joint Stereo (this will use one channel when both channels are the same, then 2 when there different therefore less space) and set up your output directory (this is where all your mp3 will be sent after they have been encoded) this directory must be manually created by you otherwise razor lame will copy the mp3 to the folder of the original file. Ok this is going to sound silly, but choose your current bit rate as 64kbits (don?t worry this will be your minimum bit rate for a VBR file)
    Now click the advanced tab, all you need to do here is set the optimisation to "Quality" this will mean the MP3s take longer to encode but the final result will be better quality for the same space.
    Next click on the VBR tab, this stands for variable bit rate and allows the bit rate of the mp3 to change throughout the song giving busier parts a greater bit rate (to keep most of the sounds) and less busy part less bit rate as they do not need as much bit rate and it will save space. Click enable VBR and Choose 320kbps as your maximum bit rate.
    Your VBR file can now use bit rates between 80kbps and 320kbps, but now you need to tell razor lame whether it should tend to use higher bit rates, or lots of lower bit rates, you do this with the quality option. I would advise you choose as this will give you great quality and a file only about 4% the size of the original.
    Now all you have to do is click the audio processing tab and choose the output sampling frequency as 44. kHz
    and encode away.
    With these options your original wav files will be compressed to 0.4 of there size as wav files but have the quality of a normal 256kbps mp3 which is 0.8 the size of an original wav file. Which means you can now fit 30%-40% more tracks without loss of quality, or you could fit the same amount of mp3s with noticeably higher quality.
    These files are as small as they can be whilst almost sounding perfect but here?s what you should consider if you want to reduce quality and size of file.
    - Change the quality in the VBR tab, instead of one try 2-5, the bigger the number the more the compression but the worse the quality of the file.
    - Lower the max bit rate for the VBR encoding, go into the VBR tab and select a lower bit rate, i wouldn?t advise going below 224kbit.
    - Don?t use stereo, Lots of people don?t seem to care, stereo or mono though 2 speakers, if you use mono, instead of the 2 speakers playing slightly different things they will both play the same, this will save space and increase quality (so you could lower the quality setting a bit more).
    At the end of the day there are lost of options for you to mess around with and its up to you to find what?s best for you, hopefully these guidelines are useful (however i would defiantly use lame)Message Edited by -Recoba- on -04-987 05:47 PMMessage Edited by -Recoba- on 03-02-2005 07:48 PM

    Bloodangel05 wrote:
    Very good guide-They didnt sticky it
    Nope, but I've bookmarked it for future reference

  • How to make website links out of background jpeg (co-ordinate tracked clicks)

    I am an illustrator working on my website that i have drawn out by hand and scanned in to a jpeg.  it is set to fit the whole screen, and i have drawn out where i want the navigation links.  how do i get dreamweaver to use co-ordinate clicking to link my webpages together?
    any help would be much appreciated!

    First just so you know, images are a very clumsy way of creating site navigation.  Each time you add new pages to your site, you must re-craft your menus in your graphics editor which gets old in a hurry.
    Second, you can't link background images to anything as they do not exist in the HTML markup.  You would need to slice up your menu items and insert them as regular images into your HTML page.  But as I said above, image-based menus are not efficient.  You would do well to use Text links and style them with CSS.  This allows for quick editing of menus directly from DW and is web friendly for search engines, translators and screen readers.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • How to make image cut-out seamless

    Hi everyone. I recently cut an image out and plonked it onto another background, but you can still see the white edge where I cut the image out. How do I get seamless blending of one image into another? A video link would really be helpful to actually watch how it's done. thank you very much.

    Here's a nifty trick...
    If the pic suits, use the wand to select the transparent background, then 'expand' the selection using 'select/modify/expand' by 1or 2 pixels, then 'feather' by same number and 'delete' that selected portion.
    Now put it on that background...
    That is the simplest version of the technique, you can tweak it but in principle, a soft edge will look 100% better, and you can even colour the fringe if you think about it.

Maybe you are looking for

  • Error while accessing role of a user

    hi , we received an error while scrolling a role assigned for the user. kindly see error msg and details displayed during that time. kindly assist. also how to Take a thread dump of the server node to find the blocking thread that causes the problem.

  • Save the PDF Form with Field Name

    HI Guys, I have the Requirment in PDF Form.The PDF Form is generated with the Adobe Live Cycle Designer.After generating the PDF Form the user filled the details in the form and save the filled form.while clicking the Save button the default PDF name

  • Solman system not shown RCA Change reporting for ABAP_Transport store

    Hi, We have configured RCA in Solman system. We try to get Change reporting comparison of ABAP_transport for Dev and Qas system. But it shows error as Different technical system in Reference and CustomValue. SAP Solution Manager 7.01 SP20 Regards, Ka

  • Swings-JEditorPane-email link

    i am having an e-mail link in html file which i am getting from the system and displaying in JEditorPane. The problem is, on clicking the link it is not opening the outlook express new mail box though it is opening it when run independent of JEditorP

  • Email Notification need anyone changes the PCD content..

    Hello, Can someone give me a solution for this issue. An email should be sent to a person if someone has changed the PCD content. Can be an iveiw property, role property, workset property etc,. Or if any thing is created or modified in PCD i should g