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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:43:31+00:00 2026-05-13T07:43:31+00:00

See the following ArrayList: List<Integer> values = new ArrayList<Integer>(); values.add(0); values.add(1); values.add(2); values.add(3); values.add(4);

  • 0

See the following ArrayList:

List<Integer> values = new ArrayList<Integer>();
values.add(0);
values.add(1);
values.add(2);
values.add(3);
values.add(4);
values.add(5);
values.add(6);

So we have:

integerList.size(); // outputs 7 elements

I need to show a Google chart as follows:

http://chart.apis.google.com/chart?chs=300×200&chd=t:60,-1,80,60,70,35&cht=bvg&chbh=20,4,20&chco=4C5F2B,BED730,323C19&chxt=y&chxr=0,0,500

To generate its values, I just call

StringUtils.join(values, ","); // outputs 0,1,2,3,4,5,6

It happens it supports up to 1000 pixel width. So if I have many values, I need to split my ArrayList into other ArrayLists to generate other charts. Something like:

Integer targetSize = 3; // And suppose each target ArrayList has size equal to 3

// ANSWER GOES HERE
List<List<Integer>> output = SomeHelper.split(values, targetSize);

What Helper should I use to get my goal?

  • 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-13T07:43:32+00:00Added an answer on May 13, 2026 at 7:43 am

    google-collections has Lists.partition(). You supply the size for each sublist.

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

Sidebar

Related Questions

Please see the following code: List list = Collections.synchronizedList(new ArrayList()); // ... synchronized (list)
I have the following get method: public List<PersonalMessage> getMessagesList() { List<PersonalMessage> newList = new
I have a list of embedded entities: @Embedded private List<EmbeddedEntity> embedded = new ArrayList<EmbeddedEntity>();
I've recently used LINQ In the following code: ArrayList list = new ArrayList(); var
:) I have int[] code = new int[10]; It has the following values: code[0]
I have the following piece of code public static void main(String[] args) { ArrayList<Integer>
I have an arraylist of objects, each containing a unique date in the following
What's the explanation for the following: public class GenericsTest { //statement 1 public ArrayList<Integer>[]
I have an ArrayList of Track objects. Each Track object has the following fields
I have the following class which as you can see contains a EditText, Button

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.