Results 1 to 4 of 4
  1. #1
    Kika is offline Member
    Join Date
    Oct 2013
    Posts
    2
    Rep Power
    0

    Default Sorting by numbers of words in each sentence that is in ArrayList index.

    Hello! I am a beginner!I have a task to sort sentences by its word quantity, that is in Arraylist.For example,here is the code of my Array example:

    List<String> numberOfWords=new ArrayList<>();

    numberOfWords.add("Happy coding!"); //2 words or 3 with(!),I don't know
    numberOfWords.add("He plays football in the playground everyday"); //7
    numberOfWords.add("She is cooking an omellette"); //5
    numberOfWords.add("I am coding in Java"); //5
    numberOfWords.add("I want to code very well"); //6

    // And the result must be like this: So, please could anyone give me some advice on how to come to this outcome??? Thanks!!!

    Happy coding! //2 words
    I am coding in Java //5 words
    She is cooking an omellette //5words
    I want to code very well //6 words
    He plays football in the playground everyday //7words

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,562
    Rep Power
    23

    Default Re: Sorting by numbers of words in each sentence that is in ArrayList index.

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Kika is offline Member
    Join Date
    Oct 2013
    Posts
    2
    Rep Power
    0

    Default Re: Sorting by numbers of words in each sentence that is in ArrayList index.

    Norm ,What does this mean ?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,562
    Rep Power
    23

    Default Re: Sorting by numbers of words in each sentence that is in ArrayList index.

    What does this mean ?
    What is the "this" you are asking about?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 8
    Last Post: 08-29-2013, 03:45 PM
  2. how to reverse the order of words in a sentence?
    By dksellou in forum New To Java
    Replies: 5
    Last Post: 11-29-2012, 04:34 AM
  3. Replies: 3
    Last Post: 07-08-2012, 11:08 PM
  4. Replies: 0
    Last Post: 03-03-2011, 04:58 PM
  5. Replies: 0
    Last Post: 02-25-2010, 12:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •