Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Which collection is best to do mathematical operation on it?

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Which collection is best to do mathematical operation on it?

    I want to make a program to take derivatives of a given function. I want to take the function from the command-line, analyze the function and separate the terms, take the derivative of each one, and display it. My question is what would be the best collection to use for this? I will give each term a slot in some collection, and run methods like hasACoefficent(), hasAnExponent(), etc to analyze the term after separating them. Then use a differentiate method on each term. Then probably go through the collection and set the answer. What do you guys think would be the best collect to do so with? ArrayList? Array(I would prefer something dynamic though)? HashMap? Can anyone give me an opinion please? Thanks.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: What kind of List?

    Hello Sterzerkmode! Welcome to the forums.

    I think the best option here would be an ArrayList. Could you give me an example input/output please?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Java program which can list all files in a given directory
    By JavaPF in forum Java Programming Tutorials
    Replies: 8
    Last Post: July 9th, 2013, 03:38 AM
  2. ClassCastException in Double Linked List toString
    By Rastabot in forum Collections and Generics
    Replies: 2
    Last Post: April 24th, 2009, 11:48 AM
  3. Recursive function based on Linked list
    By rosh72851 in forum Collections and Generics
    Replies: 1
    Last Post: March 9th, 2009, 06:23 PM
  4. Replies: 1
    Last Post: November 22nd, 2008, 01:32 PM
  5. Retrieving BFS code's adjacency list
    By moose4204l in forum Collections and Generics
    Replies: 0
    Last Post: October 20th, 2008, 06:30 PM