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

  • SEARCH
  • Home
  • 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 8030259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:42:35+00:00 2026-06-05T00:42:35+00:00

I am trying to get the values from an arraylist. I have the User

  • 0

I am trying to get the values from an arraylist.

I have the User type bean class as below..

class User{

      public String link;
      public String url;

     User(String l,String u){
           this.link=link;
           this.url=url;
      }
setters and getters below.. 

Here I am trying to write a class with main.

public class ListClass{
      public static void main(String args[]){
            List<User> list = new ArrayList<User>();
            list.add(new User("link1","url1"));
            list.add(new User("link2","url2"));
            list.add(new User("link3","url3"));

            //here i want to iterate both links and urls one by one 

            Iterator it=list.iterator();
            // remaining the code to get both link1 and url1 ..
}

I need the output as:

link1  url1
link2  url2
link3  url2
  • 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-06-05T00:42:37+00:00Added an answer on June 5, 2026 at 12:42 am

    You can use the for-in construct instead of the Iterator:

    for (User u : list) {
      System.out.println(u.link + " " + u.url);
    }
    

    If you definitely want to use the iterator:

    Iterator<User> it=list.iterator();
    while (it.hasNext()) {
      User u = it.next();
      System.out.println(u.link + " " + u.url);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to GET values from url and I have ended up with
I'm trying to get a json string back from my controller, that is prefill-values
Im trying to get some values from the below xml feed <?xml version=1.0 ?>
While i am trying to get value from arraylist,i got the following errors.My sample
I am trying to get values from a data set. My function has to
I'm trying to get the values from a pointer to a float array, but
I'm trying to get the pixel rgb values from a 64 x 48 bit
i have this form and im trying to get the value from the text
I'm trying to get familiar with Collections. I have a String which is my
I am trying to retrieve the values from the following url: http://rentopoly.com/ajax.php?query=Bo . I

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.