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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:13:32+00:00 2026-06-18T05:13:32+00:00

I want to save ArrayList from main() into my new ArrayList which is subString

  • 0

I want to save ArrayList from main() into my new ArrayList which is subString in geTles(ArrayList input_list_of_strings). How do I do that? I know that we need to do with the loop and add it up to subString. Also I want to break down the string word that I have in my code into small subStrings. Example: “SCHOOLWORK” will break down to “SC”,”HOO”,”LWO”,”RK”.

import java.util.ArrayList;

public class HW2 {

    public static ArrayList getTiles(ArrayList input_list_of_strings) {
        // create a substring by go through the loop first, then .... (instruction)
        ArrayList<String> subString = new ArrayList<>();
        return input_list_of_strings;       
    }


    public static void main(String[] args) {
        // TODO Auto-generated method stub
        ArrayList<String> input_words = new ArrayList<String>();
        input_words.add("SCHOOLWORK");
        input_words.add("BALCONY");
        input_words.add("INSIST");
        input_words.add("SALTPETER");
        input_words.add("BOLTON");
        input_words.add("KITSCHY");
        input_words.add("CLIENTELE");
        System.out.print(getTiles(input_words));    
    }
}
  • 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-18T05:13:33+00:00Added an answer on June 18, 2026 at 5:13 am

    You’re not saving anything. You’re passing the ArrayList into your method by value. I’d also argue that it’s pretty important that you design to the interface instead of the concrete implementation (that is, you’d be using List instead), and you type it so that the behavior you need in your method doesn’t involve casts or temporary variables.

    Here’s what I mean.

    public static List<String> getTiles(List<String> inputList) {
        // criteria for dividing up the strings themselves
        // logic to modify the list in-place or create a new copy to return
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Arraylist, which i want to save in a file for use
I have an ArrayList which stores a custom object. I want to serialize that
I want to save an ArrayList so that it is persistent. The contents can
I want to save values as an ArrayList of double in a file. Whenever
I want to know whether it is possible to save as an array list
I want to save image from chart graphic. I'm using following line. chart.SaveImage(D:\\mypic.png, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
I want to allow users to save a list of favourite items from a
I parsed data from json to corresponding class data and them want to save
Im trying to save an ArrayList containing multiple ArrayLists of Strings into the sharedpreferences
I have a Java application that I want to save the data in XML

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.