Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:45:16+00:00 2026-05-27T16:45:16+00:00

Hello guys maybe you maybe can help . here is my problem For example

  • 0

Hello guys maybe you maybe can help . here is my problem

For example : “I am running all over the time every time with my dog and my sister”

I want to have a list containing all the unique words from the above sentences :

List data = {I,am,running,all,over,the,time,every,with,my,dog,and,sister}

I already tried this code below but it runs slow with big sentences

List textList = new ArrayList();
    StringTokenizer stringTokenizer = new StringTokenizer(text);

    while (stringTokenizer.hasMoreElements()) {
        String tokenData = (String) stringTokenizer.nextElement();
        if ((textList.size() > 0)) {
            Boolean exist = false;
            for (int i = 0; i < textList.size(); i++) {
                if (tokenData.toLowerCase().equals(
                        textList.get(i).toString().toLowerCase()))
                    exist = true;
            }
            if (exist == false)
                textList.add(tokenData);
        } else {
            textList.add(tokenData);
        }

    }

Is there anyway other than this faster way but same result . I appreciate your reply thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:45:17+00:00Added an answer on May 27, 2026 at 4:45 pm

    try this code

    String data = "I am running all over the time every time with my dog and my sister";
    String[] arr = data.split(" ");
    
    Set<String> st = new HashSet<String>();
    
    st.addAll(Arrays.asList(arr));
    

    Set only allows unique values and will ignore duplicates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello guys can you please help me with this problem. When a simple image
Hello guys can anyone help me with the issue im having with installation of
Hello Guys can you help me for creating a TextView in title bar so
Hello guys first of all apologize for asking such a simple and yet redundant
Hello guys i have a problem streaming PDF files with php, i'm using this
Hello guys and thanks for your help as always. I am stuck on Asp.NET
hello guys i am doing some database operations in iphone .. please can anyone
Hello guys am having a problem with downloading modules. Anytime i try to download
. Hello guys, Can we write our custom controls in such a way that
Hello guys i'm making a little app in which i need to enumerate all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.