Search Results

Search found 2 results on 1 pages for 'marshmellow1328'.

Page 1/1 | 1 

  • Is there an easy way to concatenate several lines of text into a string without constantly appending

    - by Marshmellow1328
    So I essentially need to do this: String text = "line1\n"; text += "line2\n"; text += "line3\n"; useString( text ); There is more involved, but that's the basic idea. Is there anything out there that might let me do something more along the lines of this though? DesiredStringThinger text = new DesiredStringThinger(); text.append( "line1" ); text.append( "line2" ); text.append( "line3" ); useString( text.toString() ); Obviously, it does not need to work exactly like that, but I think I get the basic point across. There is always the option of writing a loop which processes the text myself, but it would be nice if there is a standard Java class out there that already does something like this rather than me needing to carry a class around between applications just so I can do something so trivial. Thanks!

    Read the article

  • Group Objects by Common Key

    - by Marshmellow1328
    I have a list of Customers. Each customer has an address and some customers may actually have the same address. My ultimate goal is to group customers based on their address. I figure I could either put the customers in some sort of list-based structure and sort on the addresses, or I could drop the objects into some sort of map that allows multiple values per key. I will now make a pretty picture: List: A1 - C1, A1 - C2, A2 - C3, A3 - C4, A3 - C5 Map: A1 A2 A3 C1 C3 C4 C2 C5 Which option (or any others) do you see as the best solution? Are there any existing classes that will make development easier?

    Read the article

1