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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:39:54+00:00 2026-05-31T08:39:54+00:00

Sorry I suspect the answer is easy but I’m getting annoyed at the way

  • 0

Sorry I suspect the answer is easy but I’m getting annoyed at the way I’m currently doing this and was trying to find another way(old python habits, sorry).
I basically want to create a list of list(list has two integers) so for example it looks like this [[0,0], [0,1],[1,2]] and so on.

Right now the two ways I have been doing it(which I don’t think is right) is the tutorial way of:

list1.add(data);
list1.add(more_data);
final_list_of_list.add(list1);

I did some digging to find another way because I’m lazy and want to do this in one shot, so I found a command that fit my needs(in terms of getting data in)

List final_list_of_list = new ArrayList();
final_list_of_list.add(new Point(0, 0)); //and so on..

The problem with point is when I look at my beautiful data I see the ugliness of this:

[java.awt.Point[x=970,y=10], java.awt.Point[x=65,y=10], java.awt.Point[x=729,y=10]

Surely there is a easier way to add the data and still have it look nice(like the format above in my example)?

  • 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-31T08:39:55+00:00Added an answer on May 31, 2026 at 8:39 am

    You could subclass Point or create your own implementation and override the toString() method to print something prettier. I think that would be easier than trying to work with lists of lists.

    Perhaps something like this:

    public class MyPoint {
        public final int x;
        public final int y;
    
        public MyPoint(int x, int y) {
            this.x = x;
            this.y = y;
        }
    
        @Override
        public String toString() {
            return "[" + x + "," + y + "]";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is a stupid question, but is there an easy way to
Sorry for question but I can't find answer anywhere on internet. I couldn't find
Sorry, I know this question is easy, but I don't know how to get
sorry for the dummy question but I cannot find a simple and clean way
I'm a n00b so I'm sorry if I'm way off with this one but
Sorry for this simple question, but I can't solve it... There is an example:
Sorry but I am not sure how to ask this question but I am
Sorry if this question seems stupid, but it's stumped me for a couple days,
Sorry if this is a really basic question, but why is there a minus
I searched here for the answer. I'm sorry if this has been asked before

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.