Easy way to create a list of strings in an object?

I'm trying to create a HashSet of Strings but I don't want to have to add each string to the HashSet. There is a constructor for HashSet that allows you to give it a Collection. But how can I create a Collection of String other than having to add each string? Can I just :
HashSet hs = new HashSet("String1", "String2", "String3", "String4");
?

This programming problem is as old as the hills, and there are a zillion ways to do it. One of the simplest is by using String.split. Example:   String separator = "[^\\w]+";
   String string = "I think, therefore I am; or maybe not. What do you think?";
   String[] array = string.split(separator);
   System.out.println("String    : \"" + string + "\"");
   System.out.println("Word count: " + array.length + " words.");The key is the String separator. This is what is known as a "regular expression." It looks pretty obtuse (and is); do some research on regular expressions to figure out it means.
This example does not account for a few special cases, such as words split between lines with hyphens, and perhaps words enclosed in double quotes. That is left as an exercise for the reader.

Similar Messages

  • Is there an easy way to create an portfoliopage on my site?

    I like to know how i can do this the best? Im not so good in Dreamweaver.
    this is my page where i like to put the portfolio in.
    Ive got a almost 10 documents wich i want to put on my page.
    i can make thumbnails from the documents for on the page.
    Looking forward to your answer..
    Regards

    Thank you very much. The last one youve send me looks the most what i have in mind. With some thumbnails and when you click on it you see a larger document.
    But it doesnt fit quite in the style of the site. You have an other example for me?
    Regards Brian
    Date: Sat, 7 Apr 2012 16:56:54 -0600
    From: [email protected]
    To: [email protected]
    Subject: Is there an easy way to create an portfoliopage on my site?
        Re: Is there an easy way to create an portfoliopage on my site?
        created by Nancy O. in Dreamweaver - View the full discussion
    You could arrange your thumbnail images in a grid and link each one to other HTML pages (view source to see the code)http://alt-web.com/TEMPLATES/Dark-Grid-II.shtmlhttp://alt-web.com/TEMPLATES/CSS-Semi-liq-p hoto-sheet.shtml Or you could arrange thumbnails in a grid and link to full size images with jQuery FancyBox (click on images)http://alt-web.com/TEMPLATES/Dark-Grid.shtml   ()__() (='.'=)(")_(") Nancy O.Alt-Web Design & PublishingWeb | Graphics | Print | Media  Specialists  http://alt-web.com/
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4320059#4320059
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4320059#4320059. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Is there an easy way of creating a distribution list from an email with multiple addresses? Those addresses are not in your contacts already, and don't need to be.

    I want to be able to take all the email addresses someone else has used to distribute an email and create the same distribution list for myself for future use.  I don't want to add all those people to anywhere in my contacts list.  I just want them to be in my "new distribution list", like "soccer families", etc.  I tried to copy and paste, but didn't get anywhere. Maybe I was close, or maybe it isn't possible.  Thoughts?

    Ed on iPad wrote:
    I don't want them in contacts because they are simply a related group (like my sons current soccer team).  People I may never need to email again after a sports season.  I don't want to have to have these people in my contacts permanently. 
    You don't. When the season is over, delete them.
    But, the text clipping should work.
    The next IOS should have a feature "create mailing list from distribution list".  A fast and simple way to retain a distribution list from an email you received.  People get copied all the time using distribution lists they may want to reuse easily, like school, sports or work groups.  Oh well.
    How is that any different from adding them to Contacts? Here's the feedback page: http://www.apple.com/feedback/
    There is a set of Mail Scripts that has a function to Add Addresses from an email to any group. But, it doesn't work with Mountain Lion.

  • Is there an easy way to create an excel list from my contacts?

    I am doing a web-marketing and I want to use my contacts in my contact list. Is there an easy way to download my contacts into an excel list format?

    Using Automator, you can export some of the infoemation to a tab delimited file which Excel can open.
    Re: Drag and drop from Contacts into Numbers not working - any solutions?
    https://discussions.apple.com/message/22309780#22309780#22309780
    You can drag a selection of contacts into Numbers and it will grab a little of the Info, putting it in columns.

  • Is there an easy way to create 2 page imposed PDFs with a background?

    I have figured out a way to create a suitable imposed single page PDF using the 'import as layer' action, the action only understands a single paged background PDF.
    In other words, I have a PDF that has the suitable marks on it with the pages marked 'Page 1' & 'Page 2'. This is the background PDF.
    I open this PDF in Acrobat and run the action that places another PDF (the 'Source' PDF) on multiple layers with different offsets.
    The original (template) PDF is 2 pages & the Source PDF for imposition is 2 pages, and even though the 'import as layer' understands that the source PDF being imposed is 2 pages, it does not seem to allow the original (template) PDF to be seen as 2 pages.
    There is a 'Target page number' option in the Preview area, but that is grayed out at 1.
    So...other than commercial applications, is there an easy way to build a 2 page PDF imposition file??
    Maybe a script?

    Sabian,
    Yes, the Quite software would be perfect, especially the 'Hot'. Tested & works great for us, but the price tag for the 'Hot' is rather steep for our relatively simple process......background template with a 'step & repeat' of the 'live' document.
    As I mentioned in the original post, to do this with a single page PDF is simple enough using an action that places the 'live' doc multiple times, but the vast majority of our publications are 2 pages.
    Currently runing the action twice for each job. I would save a bit of time if this could be automated to do both sides with one action, or one script.

  • Is there an easy way to create or import tables into muse

    I'm trying to create a website that used tables for things like league tables and results, but I need an easy way of placing them into muse.
    I've had a go at creating tables in dreamweaver and importing the resulting html and i've created tables in Indesign and imported them as jpegs, but this obviously then does not allow me to edit on the fly.
    Can anybody help.

    DAndrews1969 wrote:
    well I've since found out that CS5.5 exports pages from indesign to html, but the link I was reading about CS6 was as follows:
    http://www.adobe.com/products/indesign/features.html
    I tried exporting a table from 5.5 but it doesn't seem to recognise the specific column spaces I have set up, hopefully 6 will have improved on this.
    We hope so. From my experience with indesign cs5.5. The export to HTML feature does not maintain the layout of an indesign document. You will require a developer with knowledge of HTML to style accordingingly in DW. I don't think this is an intended workflow by Adobe. Until then I dont think Muse or Indesign will export to HTML while maintaining the integrity of the layout design including adaptive fluid layout support. The closest the Adobe team have been able to do is to export to epub format.
    My observation, Adobe should have given print designers option of exporting indesign files to Muse(With support for fluid/adaptive layout just as the export to epub format is supported). That way the fear of killing another tool in the Adobe bouquet won't arise. Something like 'Export to Muse' in Indesign cs6 would have been the killer. Why? Web design trend is converging with print design metaphor. I think Adobe should be leading that trend now. Tomorrow might be too crowded.

  • Is there an easy way to create breadcrumbs in Muse?

    I'm creating a new site and I want to add some breadcrumb navigation links, in addition to using the Menu Bar widget.
    Is there an easy way to build breadcrumb links? Or do I just create them manually?

    I got these ones for free when they were first released Adobe Muse SEO Breadcrumbs Widget You have to enter each breadcrumb which is annoying, but they're pretty easy to use. They also use schema markup which is something that no one has paid attention to. Google already noticed them in a search for my site

  • Easy way to create an array of [1, 2, ... , 4956] ?

    Is there an easy and lazy way to create an array of [1, 2, ... , 4956] ?
    Solved!
    Go to Solution.

    Use auto indexed 'For loop'.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Easy way to create DVDs from several hrs of short video clips frm digicams?

    Didn't know which group to post this to. It's a 'consumer' need but I need expert insights. I have several years of video clips in iPhoto, taken on consumer digicams and iPhone. I want an EASY way to get these strung together for burning to DVD primarily as my fail-safe backup since I don't want to trust hard-drive backups for this important family footage. I'd really like some kind of batch program or drag and drop so I can just select a bunch of files, either from the file system directly, or in iPhoto, doesn't matter to me, and shazam the program ideally knows how much can fit on a DVD, strings them together, and burns. I don't need transitions or any custom arrangement of the clips. I can know their chronology from file dates so that is close enough. I have Final Cut Express if that helps. I'm willing to spend up to $100 or so if necessary. I can also write shell scripts or Apple Script if that helps. Thanks!

    I want an EASY way to get these strung together for burning to DVD primarily as my fail-safe backup since I don't want to trust hard-drive backups for this important family footage.
    What you really want to be doing is backing up the your iPhoto Library file located in your Pictures folder in your .
    I recommend an external hard drive, but if you really want to use DVDs there are applications (like Toast) that can span across multiple DVDs.
    Matt

  • Easy way to create freeze-frame in CS4

    I've tried following the help instructions in PPro CS4 to make a 10" freeze-frame of the last frame in a sequence, but it seems rather complicated and to be honest I haven't got it to work for me. Avid has a dedicated command for this function which is very easy to use.
    I only was able to get it to work by exporting a still of the last frame and then reimporting it into my project.
    Is there an easier way of doing this please?
    Chris

    There is Frame Hold, and the Help File has pretty good coverage of the ins-and-outs.
    Personally, for most of my Freeze Frames, I use your workflow, and just Export/Import.
    Note: things changed with CS4, and got complicated, until about the CS4.2 update. I think that the updates are up to CS4.3. If you have not updated to at least CS4.2, I would do that.
    While I am not a fan of a "big button" solution, I think that having such for Export Still Frame, and then automatically (via a toggle ON, or OFF) Importing into the Project would be a good one. In earlier versions of PrPro, things were easier. I use the Export/Import Still more for creating Menu animations for use in Encore, rather than traditional Freeze Frames, but feel that things could be much easier, than they are, even with the updates.
    Good luck,
    Hunt

  • Easy way to create an Org Chart in AppleWorks?

    I have used MS PowerPoint to create and maintain Org charts in the past. I see that the Presentation piece of AppleWorks has similar functionality to PowerPoint.
    Is there an easy way to start making an Org Chart (Supervisor, subordinates, etc) or do I just create circles and lines and create the "hard way?"

    If, by the "hard way", you mean "manually", then with AppleWorks, yes.

  • How to create a list of string if a regular expression is given ?

    Hi folks,
    I have a regular expression say abcd[a-z]\\\.[0-9] . ( please ignore one '\')
    For this string i know that
    following string matches successfully
    1. abca.0
    2. abcb.1
    3. abcz.9 ......etc n number of combination are possible.
    is there any algorithm which will create some randomn strings from a regular expression.
    input to algorithm : some string pattern
    output to algorithm : some matching strings ( can be a single or an array of matching strings)
    Thanks in advance..
    Sethu
    Edited by: Sethumadhavan on Apr 16, 2008 6:32 AM

    Can u please give little more explanation...
    If i get some some values i can exit with the values ... and from the values i got i can ignore the duplicates ...
    But i am not getting the basic algorithm to get list of strings.....( DFA? or NFA?)
    thanks
    sethu

  • What is the easy way to create a crossword with InDesign CS5 for a interactive pdf?

    I mean I want to create a pdf magazine and i like to include a crossword. I read somewhere that one way is create a crossword with an external software and include it in the ID project but I don't know any crossword software and if I add in my ID project, I only need to export like a interactive pdf? I would like that the users can use the crossword in online version.
    Regards from Lima, Perú

    Hi.
    I'm not sure about what to you mean. But I create first the crossword with Excel, I mean to put the words in the right order and the questions and/or cue too. Then I create a table in InDesign and format some cells with black background and some borders. I upload both captures, from Excel and from InDesigne. Then with Adobe X Pro I create a form, so I can create singles inputs for the crossword.
    I hope i understand your question.
    Regards from Lima, Perú

  • Easier way to create All-Day Events?

    Creating an All-Day Event seems a little cumbersome to me and I was wondering if I was missing something. Is there a way to create an All-Day Event from scratch, meaning keyboard command/menu item? The only way I can find is to create a timed event, then mark it an All-Day Event with an extra step. I know you can click inside the Event section of the day in Week view, but if the day you are working on has the most All-Day entries, there is no place to click.
    There is a command for New Event. Why not All-Day Event? I am sure I missing something, but I have searched the Help menus and support groups and cannot find a way to do it.
    Thanks,
    whardy7

    Yes, I have. That is quite obvious. But, what do you do when there is already one there? That one takes up the empty space for double-clicking. If a different day has 2 events, you get lucky. In that case, there is empty space because the All-Day Events box grows to accommodate the highest number of All-Day Events for that given week.
    Let me ask my question again. Once the All-Day Events box is full (which is dependent on the day with the most events - could be 1 event, 2 events, etc.), how do you add an All-Day Event? It seems there is no way. You have to create a timed event, then convert it. If your timed area is already full of events, that can be really tricky.
    I hope that is clearer.

  • What are easy ways to create these effects or graphics?

    Hello,
    I am trying to create a logo for a new business whose product is electronic cleaning cloths for iPads, computer monitors, or most things digital.
    Therefore, I am trying to find out ways of creating motifs or design elements, parts of which I might incorporate in the logo. Thus, I would like to know how to create the following digital looks. There are a lot of questions here. I don't expect anyone to answer them all, just what you comfortably know and whatever is convenient for you to spare a few minutes to explain and/or show.
    Thanks!  : )
    1. How can I create lines like these that glow?
    2. How do I create the "stitching" or dotted line pattern in the circles and rectangle below.
    3. How do I create the circuitry lines with their circlular terminals (or do I just use pen tool in Illustrator CS5?
    4. Finally, how can I create these circuitry lines and shapes?

    A word of caution here.  Yes, all of the effects you are showing can be done, either in Photoshop or Illustrator.  I'm thinking gradient mesh and blends for the glows.  A dotted line could be created in the stroke palette.  But, just because you can do it, doesn't mean you do it.  Logos are typically very basic so they can be implemented across a large area of application ( i.e., signs, vehicle graphics, letterhead and stationery, advertising, and internet applications ).  If you were to create a sophisticated graphic effect, it would not hold-up in all of the potential uses and surely would not be rendered consistently.  You will get vendor's who complain about this or that regarding your artwork.  Try to think basic lines in Black and White that could easily be reproduced on an office copier.  Later on, you can use the basic logo in a more sophisticated application where it would be appropriate.

Maybe you are looking for

  • Printing w/o headers and footers in OSX10.5

    I am trying to print from Firefox (or any other browser) without the header and footer. I have seen posts from other places saying to use the 'Page SetUp' to adjust margins, remove headers/footers etc, but in OSX10.5 those options are not available.

  • Does the new imac support 3D movie play?

    I was wondering if the newest iMac can play 3D movies, like the new 3d blue ray/3D tv can, anyone knows about this?

  • Populating E1EDP05 segment of idoc type INCOIC01

    Hi guys, I have an issue for the AUTO LIV where the inbound idoc has this segment E1EDP05 which now has just one currency type being filled in which is causing an error while processing the idoc saying "<b>The IDOC does not contain all necessary curr

  • Flash sites won't run...

    For about the last 3 months or so I've been unable to view any Flash on websites - I just get the message telling me to install it. I've tried uninstalling and reinstalling - that made no difference however after reinstalling the Abobe Flash page run

  • CRMM_BUT_CUSTNO

    Hi Experts                   In table Crmm_but_custno (in CRM) we found that the field Account_Group is empty for all the records. But in transaction BP, we are able to view the Account Group under the Classification Tab. What could be the reason? Po