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 9202961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:22:23+00:00 2026-06-17T23:22:23+00:00

I have two list X,Y. Which are lists of Strings . there is a

  • 0

I have two list X,Y.

Which are lists of Strings .

there is a possibility to have the two lists different sizes .

If both lists are of same size of 2 then i can procedd like

   for (int i =0;  i<anyList.size(); i++){
     system.out.printLn(X(i) +" "+Y(i));
  }

example result  :

stringX1 stringY1 
stringX2 stringY2

how can i handle the loop which have different sizes

example result should be look like this

example result :

    stringX1 stringY1 
    stringX2 stringY2
    stringX3
    stringX4
  • 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-17T23:22:25+00:00Added an answer on June 17, 2026 at 11:22 pm
    for (int i =0;  i<max(X.size(),Y.size()); i++){
      if(i<X.size() && i<Y.size()) {
        print(X.get(i) + " " + Y.get(i));
      } else if(i<Y.size()) {
        print(Y.get(i));
      } else {
        print(X.get(i));
      }
    }
    

    Programming a max(int, int) and print(String) method shouldn’t be to hard.

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

Sidebar

Related Questions

I have two lists of strings both of which are ~300,000 lines. List 1
I have two files which both contain a list of words. Is there an
I have two lists of the same type of object. One list comes from
I have two lists. The types of both lists inherit from the same base
I have the following scenario: Two lists of different Types which happen to contain
I have an ordered list which I have styled in two ways: Coloured the
I have two polygons which are defined by a list of points: x1,y1; x2,y2;
I have a list of items, which has two values, a name and an
I have a method which compares two objects and returns a list of all
I have one drop down list in my page, which contains two options. What

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.