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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:03:08+00:00 2026-05-18T04:03:08+00:00

I have this class: public abstract class Directory { protected int id; protected File

  • 0

I have this class:

public abstract class Directory {

    protected int id;
    protected File path;
    protected LinkedList<Filter> filters;
    protected LinkedList<File> files;
    protected int wildcard;
    public static int numCols = 3;

    /* other things */
}

And I wrote this table model:

public class DirectoryListTableModel extends AbstractTableModel {

    private static final long serialVersionUID = 1L;
    private LinkedList<Directory> datalist;
    private String[] columnNames= {"ID", "Directory", "Wildcard", "Filters"};


    public DirectoryListTableModel(){
    }

    public void setDatalist(LinkedList<Directory> temp){
        this.datalist = temp;
    }

    public void showElement(){
        fireTableRowsInserted(this.datalist.size()-2,this.datalist.size()-2);
    }

    public LinkedList<Directory> getDatalist(){
        return (LinkedList<Directory>) this.datalist.clone();
    }

    @Override
    public String getColumnName(int column) {
        return this.columnNames[column];    
    }

    @Override
    public int getColumnCount() {
        return Directory.numCols;
    }

    @Override
    public int getRowCount() {
        return this.datalist.size();
    }

    @Override
    public Object getValueAt(int row, int col) {

        Directory temp = this.datalist.get(row);

        switch(col){
        case 0:
            return temp.getId();
        case 1:
            return temp.getPath();
        case 2:
            return temp.getWildcard();
        default:
            return null;        
        }
    }
}

As you can see I have a LinkedList<Filter> that I would like too show as a simple string. How can I do that?

  • 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-18T04:03:08+00:00Added an answer on May 18, 2026 at 4:03 am

    e.g.:

    case 3:
        return temp.getFilters().toString();
    

    Note:

    • Use the interface (e.g. List) rather than the implementation (LinkedList) when declaring fields (if you don’t have a good reason to do otherwise).
    • ArrayList has a better performance than LinkedList in most cases (e.g. such as access by index)
    • Also override getColumnClass
    • Keep your fields private
    • setDatalist: fireTableDataChanged
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this class public static class MyClass { static MyClass() { ...
I have this plugin in the plugins directory within the admin module directory. So,
I have a problem with a mapping for this structure that i designed public
I have this code and I want to keep it elegant. I got stuck
What would be the return type of the following method? ( T ) public
I have a list of about 25 types found in the Microsoft .NET assembly
I was writing a class that uses __get() and __set() to store and retrieve
So basically i have a domain object and a generic repository that can do
As mentioned in the Zend Framework manual , I created a base controller. Subclassing
SHORT FORM(!) In response the Jon Skeet's comment, what I want C# to be

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.