Results 1 to 7 of 7
Thread: Help with UNI tasks
- 10-26-2010, 01:52 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 3
- Rep Power
- 0
Help with UNI tasks
sorry i didn't know. the first question is to convert the ADT to a generic type.
Would the following be an example of changing it to generic. e.g.
//original coding
public interface SetADT
{
// Adds one element to this set
public void addElement (Object element);
}
----------------------------------------------------------
//Attempt at generic
public interface SetADT <T>
{
// Adds one element to this set
public void T add (T e);
}
that anywhere near it or am i completely wrong?
sorry again!Last edited by Roshi; 10-26-2010 at 02:25 PM.
- 10-26-2010, 01:56 PM #2
Senior Member
- Join Date
- Feb 2010
- Location
- Ljubljana, Slovenia
- Posts
- 470
- Rep Power
- 4
Posting an assignment list and asking for code is not a good way to get help around here. Show us what you've attempted and ask more specific questions, you'll find a lot of people who are willing to help here if you show some effort.
Ever seen a dog chase its tail? Now that's an infinite loop.
- 10-26-2010, 02:13 PM #3
Uninformative title, typos, SMS-speak, complaining about your situation, linking somewhere else to get to any actual information, not asking a question, requesting "the codes", homework dumping, asking somebody else to do your homework and email it back, and complaining about your deadlines.
Congratulations, you've managed to break just about every rule about not annoying your would-be helpers, all in a single post. Well done.
How To Ask Questions The Smart Way
- 10-26-2010, 02:26 PM #4
Member
- Join Date
- Oct 2010
- Posts
- 3
- Rep Power
- 0
edited the 1st post. sorry
- 10-26-2010, 02:42 PM #5
- 10-26-2010, 04:08 PM #6
Member
- Join Date
- Oct 2010
- Posts
- 3
- Rep Power
- 0
to be honest i wouldn't even be able to do that lol. I just have to convert it to a generic typed ATD. I was messing about and am thinking either . . . .
public interface SetADT <T>
{
// Adds one element to this set
public T add(T e);
or
public void add(T e)
Would that work and the other work if i was wanting to return an object of "T". it doesn't specify if i need to, i just need to convert an abstract of code to a generic type.
- 10-26-2010, 05:29 PM #7
Member
- Join Date
- Apr 2010
- Posts
- 55
- Rep Power
- 0
Similar Threads
-
project with 5-6 java (and a bit xml) tasks
By nortelnet in forum Jobs OfferedReplies: 2Last Post: 08-18-2008, 07:38 AM -
Scheduling tasks using Threads
By Java Tip in forum Java TipReplies: 0Last Post: 12-11-2007, 10:24 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks