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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:17:56+00:00 2026-06-08T18:17:56+00:00

I have created my own custom Linked List (code is below). Now, I can’t

  • 0

I have created my own custom Linked List (code is below). Now, I can’t understand how to create an array of that Linked list like LinkedList[] l = new LinkedList[10]. Can anyone help me.

class Node {
      public int data;
      public Node pointer;
}

class LinkedList {
      Node first;
      int count = 0;

      public void addToEnd(int data){
            if(first == null){
                  Node node = new Node();
                  node.data = data;
                  node.pointer = null;
                  first = node;
                  count = 1;
                  return;
            }
            Node next = first;
            while(next.pointer != null){
                  next = (Node)next.pointer;
            }
            Node newNode = new Node();
            newNode.data = data;
            newNode.pointer = null;
            next.pointer = newNode;
            count++;
      }

      public Node getFirst(){
            return first;
      }
      public Node getLast(){
            Node next = first;
            while(next.pointer != null)
                  next = next.pointer;
            return next;
      }


      public int[] get(){
        if(count != 0){
            int arr[] = new int [count] ;
            Node next = first;
            int i = 0;
                  arr[0]= next.data;
            while(next.pointer != null){
                  next = next.pointer;
                  i++;
                  arr[i] = next.data;
            }
            i++;
            return arr ;
            }
            return null ;
      }
      public int count(){
            return count;
      }
}
  • 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-08T18:17:57+00:00Added an answer on June 8, 2026 at 6:17 pm

    I’m going to guess that your problem is just that when you create an array of objects, like

    LinkedList[] lists = new LinkedList[10];
    

    you get an array full of nulls; you need to create objects to store in the array:

    for (int i=0; i<lists.length; ++i)
        lists[i] = new LinkedList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom list view, each row has it's own custom selector,
I have create my own NSOpenGLView class, right now the data that i want
I am trying to create my own Native win32 C++ Checkbox that can have
I have created a custom list view and created my own adapter class I
I have created an editable UITableView that supports several custom UITableViewCells of my own
Hope you can help. I have created my own Custom UIView and I'm trying
I have created my own custom workflow (for now this is just adhoc workflow
I have created my own custom role provider class SGI_RoleProvider and configured properly. Everything
I created my own custom keyboard following the the example in the sdk. Now
I have created a custom alertdialog by the following code: AlertDialog.Builder builder; AlertDialog alertDialog;

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.