Help in the add method

how can i implement the code in the add method, and how should i add a main method to print the list.
import java.util.*;
public class SinglyLinkedList implements List
  // an inner class: This is our node class, a singly linked node!
  private class Node
    Object data;
    Node next;
    Node(Object o, Node n)
      data = o;
      next = n;
    Node(Object o)
      this(o, null);
    Node( )
      this(null,null);
  private Node head; // the "dummy" head reference
  private int size;  // the number of items on the list
  public SinglyLinkedList()
    head = new Node(); // dummy header node!
  public void add(int index, Object o)
  //need some help here
  public boolean add(Object element)
       if (element == null) return false;
       // Check for dummy head node
       if (head.data == null)
            head = new Node(element, null);
    else
    // Traverse the list until we find the end
    Node next = head;
    while (next.next != null)
         next = next.next;
    next.next = new Node(element, null);
    return true;
public static void main (String[] args){
  //need some help here
}

you not need to implement List you can just use add methods of it cause
if you implementing it without implements all the methods in it then you
must declare you class as abstract class;
if you implemets List then your class should contains all the methods of interface List for example
import java.util.*;
public class SinglyLinkedList implements List
  // an inner class: This is our node class, a singly linked node!
  private class Node
    Object data;
    Node next;
    Node(Object o, Node n)
      data = o;
      next = n;
    Node(Object o)
      this(o, null);
    Node( )
      this(null,null);
  private Node head; // the "dummy" head reference
  private int size;  // the number of items on the list
  public SinglyLinkedList()
    head = new Node(); // dummy header node!
  public void add(int index, Object o)
    //need some help here
  public boolean add(Object element)
    if (element == null) return false;
    // Check for dummy head node
    if (head.data == null)
      head = new Node(element, null);
    else
      // Traverse the list until we find the end
      Node next = head;
      while (next.next != null)
        next = next.next;
      next.next = new Node(element, null);
    return true;
  public int size(){
  return 0;
  public boolean isEmpty(){
    return false;
  public boolean contains(Object o){
    return false;
  public Iterator iterator(){
    return null;
  public Object[] toArray(){
    return null;
  public Object[] toArray(Object a[]){
    return null;
  public  boolean remove(Object o){
    return false;
  public boolean containsAll(Collection c){
    return false;
  public  boolean addAll(Collection c){
    return false;
  public boolean addAll(int index, Collection c){
    return false;
  public boolean removeAll(Collection c){
    return false;
  public boolean retainAll(Collection c){
    return false;
  public void clear(){}
  public boolean equals(Object o){
    return false;
  public  int hashCode(){
    return 0;
  public Object get(int index){
    return null;
  public  Object set(int index, Object element){
    return null;
  public Object remove(int index){
    return null;
  public int indexOf(Object o){
    return 0;
  public int lastIndexOf(Object o){
    return 0;
  public ListIterator listIterator(){
    return null;
  public ListIterator listIterator(int index){
    return null;
  public List subList(int fromIndex, int toIndex){
    return null;
  public static void main (String[] args){
    //need some help here
}

Similar Messages

  • Eclipse don't schow me the add Methods from IPage and IiView

    Hello Together
    I'm developing a WebDynpro that should add and remove iViews to/from a page. The Server we use is J2EE 7.01 (Portal 7 EHP1)
    For this I want to use the following code. Which is shown in the Developerguide NW2004s:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
    InitialContext iCtx = null;
    try
    iCtx = new InitialContext(env);
    IPage myPage =(IPage)iCtx.lookup("pcd:portal_content/Desktop/finance");
    INewObjectDescriptor iViewDescriptor = (INewObjectDescriptor)iViewSrv.instantiateDescriptor (CreateMethod.DELTA_LINK, "pcd:portal_content/testxml", request.getUser());
    myPage.addiView(iViewDescriptor,"testxml");
    catch(Exception e)
    The the problem I have now is, that eclipse does not know the method addiView or any other add Method.
    So I tried to find out which mehtods exists in the class IPage which I use here.
    For this I used the following code:
    IPrivateChangeIviewInPageView.IMethodnamesNode methodNode = wdContext.nodeMethodnames();
    IPrivateChangeIviewInPageView.IMethodnamesElement methodElem = null;
    IUser sapUser = WDClientUser.getLoggedInClientUser().getSAPUser();
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, sapUser);
    env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
    try {
      InitialContext iCtx = new InitialContext(env);
      com.sap.portal.pcm.page.IPage myPage =(com.sap.portal.pcm.page.IPage)iCtx.lookup("pcd:portal_content/tgdmopa7/com.tgdmopa7.updatePage");
      Method[] meth = myPage.getClass().getMethods();          
      for (int i = 0; i < meth.length; i++) {
        Method m = meth<i>;
        methodElem = methodNode.createMethodnamesElement();
        methodElem.setName(m.getName());
        methodNode.addElement(methodElem);
    } catch (NamingException e) {
    In the table which shows the methods of the IPage class the add-Methods are shown.
    I added the following jar-Files from the J2EE-Server to the classpath:
    - com.sap.portal.ivs.api_iview_api.jar
    - com.sap.portal.navigation.api_service_api.jar
    - com.sap.portal.pcd.basicrolefactory_api.jar
    - com.sap.portal.pcd.glservice_api.jar
    - com.sap.portal.pcm.admin.apiservice_api.jar
    - prtjndisupport.jar
    - gl_api.jar
    In the sharing References I refere to:
    - PORTAL:sap.com/com.sap.portal.ivs.connectorservice
    - PORTAL:sap.com/com.sap.portal.ivs.api_iview
    - PORTAL:sap.com/com.sap.portal.ivs.iviewservice.oldpcm.iviews_dt
    - PORTAL:sap.com/com.sap.portal.pcd.basicrolefactory
    - PORTAL:sap.com/com.sap.portal.pcd.glservice
    - PORTAL:sap.com/com.sap.portal.ivs.api_landscape
    - PORTAL:sap.com/com.sap.portal.navigation.api_service
    - PORTAL:sap.com/com.sap.portal.iviewservice.templates_cache_srv
    - PORTAL:sap.com/com.sap.portal.pcm.admin.apiservice
    Does somebody know why I do not see the add methods in eclipse?
    Kind Regards
    Pascal

    I got the solution. I have imported now the com.sap.portal.ivs.api_portalpcm_api.jar and then eclipse find the addMethods.

  • Need some help with the String method

    Hello,
    I have been running a program for months now that I wrote that splits strings and evaluates the resulting split. I have a field only object (OrderDetail) that the values in the resulting array of strings from the split holds.Today, I was getting an array out of bounds exception on a split. I have not changed the code and from I can tell the structure of the message has not changed. The string is comma delimited. When I count the commas there are 26, which is expected, however, the split is not coming up with the same number.
    Here is the code I used and the counter I created to count the commas:
    public OrderDetail stringParse(String ord)
    OrderDetail returnOD = new OrderDetail();
    int commas = 0;
      for( int i=0; i < ord.length(); i++ )
        if(ord.charAt(i) == ',')
            commas++;
      String[] ordSplit = ord.split(",");
      System.out.println("delims: " + ordSplit.length + "  commas: " + commas + "  "+ ordSplit[0] + "  " + ordSplit[1] + "  " + ordSplit[2] + "  " + ordSplit[5]);
    The rest of the method just assigns values to fields OrderDetail returnOD.
    Here is the offending string (XXX's replace characters to hide private info)
    1096200000000242505,1079300000007578558,,,2013.10.01T23:58:49.515,,USD/JPY,Maker,XXX.XX,XXX.XXXXX,XXXXXXXXXXXXXXXX,USD,Sell,FillOrKill,400000.00,Request,,,97.7190000,,,,,1096200000000242505,,,
    For this particular string, ordSplit.length = 24 and commas = 26.
    Any help is appreciated. Thank you.

    Today, I was getting an array out of bounds exception on a split
    I don't see how that could happen with the 'split' method since it creates its own array.
    For this particular string, ordSplit.length = 24 and commas = 26.
    PERFECT! That is exactly what it should be!
    Look closely at the end of the sample string you posted and you will see that it has trailing empty strings at the end: '1096200000000242505,,,'
    Then if you read the Javadocs for the 'split' method you will find that those will NOT be included in the resulting array:
    http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)
    split
    public String[] split(String regex)
    Splits this string around matches of the given regular expression.  This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
    Just a hunch but your 'out of bounds exception' is likely due to your code assuming that there will be 26 entries in the array and there are really only 24.

  • Can anyone help me to add method to rotate the image using mouse?

    Hi everyone, i am currently creating a game which require the user to be able to drag and rotate the image
    on the screen..but sadly...i'm only able to do the dragging part..
    Can anyone be able to help me add the method to rotate the image using the mouse?
    Thanks :-)
    the code
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    class Game extends JFrame {
         DisplayCanvas canvas;
         public Game() {
              super("My Game");
              Container container = getContentPane();
              canvas = new DisplayCanvas();
              TitledBorder border = new TitledBorder("Game Window");
              border.setTitlePosition(TitledBorder.BOTTOM);
              canvas.setBorder(border);
              container.add(canvas);
              addWindowListener(new WindowEventHandler());
              setSize(450,400);
              show();
              class WindowEventHandler extends WindowAdapter {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              public static void main(String arg[]) {
                   new Example();
         class DisplayCanvas extends JPanel {
              int x, y;
              BufferedImage bi;
              DisplayCanvas() {
                   setBackground(Color.white);
                   setSize(450,400);
                   addMouseMotionListener(new MouseMotionHandler());
                   Image image = getToolkit().getImage("duke.gif");
                   MediaTracker mt = new MediaTracker(this);
                   mt.addImage(image, 1);
                   try {
                        mt.waitForAll();
                   catch (Exception e) {
                        System.out.println("Exception while loading image.");
                   if (image.getWidth(this) == -1) {
                        System.out.println("***Make sure you have the image "
                        + "(duke.gif) file in the same directory.*****");
                        System.exit(0);
                   bi = new BufferedImage(image.getWidth(this),
                   image.getHeight(this),
                   BufferedImage.TYPE_INT_ARGB);
                   Graphics2D big =bi.createGraphics();
                   big.drawImage(image, 0, 0, this);
              public void paintComponent(Graphics g) {
                   super.paintComponent(g);
                   Graphics2D g2D = (Graphics2D) g;
                   g2D.drawImage(bi, x, y, this);
              class MouseMotionHandler extends MouseMotionAdapter {
                   public void mouseDragged(MouseEvent e) {
                        x = e.getX(); y = e.getY();
                        repaint();

    research a bit on AffineTransforms. you can set the rotated instance of the Graphics2D class and it will do the rotations for you :-D

  • What is wrong with this implimentation of the .add() method?

    Here is a simplified version of the primary bug in a much larger hunk of code. If you run this code you will notice that ONLY the 20th iteration of the array1 data gets added to the ArrayList. WHY??! I need all the unique arrays added. Please help.
    import java.util.ArrayList;
    import java.util.Random;
    public class listBuilder {
         public static void main(String args[]){
              ArrayList<long[]> uArrayList = new ArrayList<long[]>();
              int N = 7, L = 20;
              long[] array1 = new long[N];
              long[] array2 = new long[N];
              Random why = new Random();
              for (int i=0; i < L; i++){
                   for (int j = 0; j < N; j++){
                        array1[j] = (long)why.nextInt(10);
                   uArrayList.add(array1);
              for (int i = 0; i < L; i++){
                   System.out.print(i + ": ");
                   array2 = (long[])uArrayList.get(i);
                   for (int j = 0; j < N; j++){
                        System.out.print(array2[j] + " ");
                   System.out.println();
    }

    Try this:
    public class listBuilder {
         public static void main(String args[]){
              ArrayList<long[]> uArrayList = new ArrayList<long[]>();
              int N = 7, L = 20;
              Random why = new Random();
              for (int i=0; i < L; i++){
                   long[] array1 = new long[N];
                   for (int j = 0; j < N; j++){
                        array1[j] = (long)why.nextInt(10);
                   uArrayList.add(array1);
              for (int i = 0; i < L; i++){
                   System.out.print(i + ": ");
                   long[] array2 = (long[])uArrayList.get(i);
                   for (int j = 0; j < N; j++){
                        System.out.print(array2[j] + " ");
                   System.out.println();
    }

  • New (1.5) add(*) method does not always equal to getContentPane().add(*);

    Just came across something people might not be aware of,
    The add(*) method provided in 1.5 does not always produce the same result as getContentPane().add(*)...
    Setting the contentPane (of a JFrame) to a JTabbedPane should mean that when you "add" a component (using the add(somComponent)) you get (according to the documentation) a tab whose text defaults to c.getName(). However, when you call add(someComponent) you get no tab text....changing the call to getContentPane().add(someComponent) brings it back...
    Bit odd....
    Thanks,
    Michael

    I don't use 1.5 so I can't comment, but this months [url http://java.sun.com/developer/JDCTechTips/]Core Java Technology Tech Tip may (or may not) help.

  • Error RE: add method in GUI application

    I'm trying to put three circles (red, yellow, green) in a sub panel called "trafficLight." Unfortunately, I keep getting the following error message that prevents me from compiling the program:
    *.\TrafficPanel.java:36: cannot find symbol*
    symbol  : method add(Circle)
    location: class javax.swing.JPanel
    *          trafficLight.add(red);*
    I believe I have all the import statements necessary, and the program will compile with the trafficLight.add(particular color - red, yellow or green) removed. In other words, if I leave the add(trafficLight); method, the program will compile, and I will see the sub panel trafficLight, just no circles. The class code with the add methods is below followed by my other classes.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class TrafficPanel extends JPanel
         private final int PRIMARY_PANEL_WIDTH = 1000;
         private final int PRIMARY_PANEL_HEIGHT = 700;
         private final int TRAFFICLIGHT_PANEL_WIDTH = 400;
         private final int TRAFFICLIGHT_PANEL_HEIGHT = 660;
         private final int DIAMETER = 30;
         private final int Xr = 10;
         private final int Yr = 10;
         private final int Xy = 10;
         private final int Yy = 200;
         private final int Xg = 10;
         private final int Yg = 400;
         private JPanel trafficLight;
         private Circle red, yellow, green;
         public TrafficPanel()
              setBackground(Color.gray);
              setPreferredSize(new Dimension(PRIMARY_PANEL_WIDTH, PRIMARY_PANEL_HEIGHT));
              trafficLight = new JPanel();
              trafficLight.setBackground(Color.black);
              trafficLight.setPreferredSize(new Dimension(TRAFFICLIGHT_PANEL_WIDTH, TRAFFICLIGHT_PANEL_HEIGHT));
              red = new Circle(Xr, Yr, DIAMETER, DIAMETER, Color.gray);
              yellow = new Circle(Xy, Yy, DIAMETER, DIAMETER, Color.gray);
              green = new Circle(Xg, Yg, DIAMETER, DIAMETER, Color.gray);
              trafficLight.add(red);
              trafficLight.add(yellow);        // PROBLEM AREA. I DON'T KNOW WHY??
              trafficLight.add(green);
              add(trafficLight);
         public void paintComponent(Graphics page)
              super.paintComponent(page);
              red.draw(page);
              yellow.draw(page);
              green.draw(page);
    import javax.swing.*;
    import java.awt.*;
    public class Circle
         private int X, Y, Width, Height;
         private Color color;
         public Circle(int x, int y, int width, int height, Color c )
              X = x;
              Y = y;
              Width = width;
              Height = height;
              color = c;
         public void draw(Graphics page)
              page.setColor(color);
              page.fillOval(X, Y, Width, Height);
         public void setColor(Color c)
              color = c;
    import javax.swing.*;
    public class TrafficLight
         public static void main(String[] args)
              JFrame frame = new JFrame("Traffic Light");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              TrafficPanel primary = new TrafficPanel();
              frame.getContentPane().add(primary);
              frame.pack();
              frame.setVisible(true);
    }

    Still having trouble getting the circles to appear on the sub panel "light." They are showing up on the primary panel and being covered by the sub panel. Here's the code. Please give me a strong hint, at least. This is not a school assignment; I'm just trying to learn this for school next fall.
    import javax.swing.*;
    import java.awt.*;
    public class TrafficLight extends JPanel
         Circle red, yellow, green;
         public static void main(String[] args)
              final int DIAMETER = 30;
               final int Xr = 500;
              final int Yr = 10;
              final int Xy = 500;
              final int Yy = 200;
              final int Xg = 500;
               final int Yg = 400;
              JFrame frame = new JFrame("Traffic Light");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              TrafficPanel primary = new TrafficPanel();
              Circle red = new Circle(Xr, Yr, DIAMETER, DIAMETER, Color.red);
              Circle yellow = new Circle(Xr, Yr, DIAMETER, DIAMETER, Color.yellow);
              Circle green = new Circle(Xr, Yr, DIAMETER, DIAMETER, Color.red);
              frame.getContentPane().add(primary);
              frame.pack();
              frame.setVisible(true);
         public void paintComponent(Graphics page)
              super.paintComponent(page);
              red.draw(page);
              yellow.draw(page);
              green.draw(page);
    import javax.swing.*;
    import java.awt.*;
    public class TrafficPanel extends JPanel
         private final int PRIMARY_PANEL_WIDTH = 1000;
         private final int PRIMARY_PANEL_HEIGHT = 700;
         private final int TRAFFICPANEL_PANEL_WIDTH = 400;
         private final int TRAFFICPANEL_PANEL_HEIGHT = 660;
         private JPanel light;
         public TrafficPanel()
              setBackground(Color.green);
              setPreferredSize(new Dimension(PRIMARY_PANEL_WIDTH, PRIMARY_PANEL_HEIGHT));
              light = new JPanel();
              light.setBackground(Color.black);
              light.setPreferredSize(new Dimension(TRAFFICPANEL_PANEL_WIDTH, TRAFFICPANEL_PANEL_HEIGHT));
              add(light);
    import javax.swing.*;
    import java.awt.*;
    public class Circle
         private int X, Y, Width, Height;
         private Color color;
         public Circle(int x, int y, int width, int height, Color c )
              X = x;
              Y = y;
              Width = width;
              Height = height;
              color = c;
         public void draw(Graphics page)
              page.setColor(color);
              page.fillOval(X, Y, Width, Height);
         public void setColor(Color c)
              color = c;
    }

  • Implmenting Reminders for a Notification - What is the correct method?

    Hi,
    I am trying to implement sending out reminders to a person who has a notification open.
    A Manager(UserA) gets assigned a notification(NoteA) to approve/reject. After 7 days, he should get a reminder saying that NoteA is waiting for his decision. The way I implemented this is that after 7 days, the NoteA times out and sends out a new notification(NoteB).
    However, the problem is that within 7 days, the UserA might have reassigned this NoteA to another Manager(UserB) for evaluation. So, when it times out, NoteB gets assigned back to UserA. Needless to say, UserA is now unhappy!
    There was an example in the FAQ about implmenting reminders, but I beleive even if I implment the method suggested in the FAQ, I will end up with the same problem described above, since the reminder notifications will still go to UserA.
    Would appreciate any help on the corrrect method to implment reminders. FYI- I am using standalone workflow.
    Thanks
    Dev

    Dev, you could always write a post notification function which detected the REASSIGN and assigned the new performer to an item attribute, which would then be used as the performer for the reminder notification.

  • Imitating the add() function without actually adding a Applet object

    Okay, I have an instance of an object that ultimately extends Applet (not JApplet). I want this applet to paint itself onto another instance of JFrame without adding (performing the add(component) method) the applet instance.
    Note though that if I do add the applet to the JFrame, the object is painted correctly and everything works fine. But for some reasons specific to me (that I don't want to go into details with), I do not want to add the applet.
    I would want to do something like this:
    Applet instance = /* my instance */
    JFrame frame = /* my frame */
    JPanel pane = new JPanel(new BorderLayout()) {
      public void paint(Graphics g) { instance.paint(g) }
      public void update(Graphics g) { instance.update(g) }
    frame.add(pane);Using the above concept, the frame doesn't get any painting. Exactly what does the add method do that I'm not imitating here? I've tried looking through the source and I don't see much changing of the actual instance. I also tried setting the parent of the applet (using reflect) to my JPanel (above example), but that did nothing. I tried doing that since I thought the applet may have uses the getGraphics() method for getting a graphics to draw with. BTW, I do not have source code to the Applet instance: I'm trying to make this dynamic.
    Thanks in advance for any support
    Message was edited by:
    khaoz
    null

    There are 2 problems I can think of:
    1. Calling paint on heavyweight components does no drawing to the graphics object. You can see this if you try to use the java print API to print a heavyweight button or something
    2. I'm not sure that calling paint on Applet causes the applets children to get drawn.
    Your best bet might be to use the java.awt.Robot, do a screen scrape of your applet and then draw that in your frame.

  • Accessing add() methods through bean properties ?!

    I hope this question is trivial...
    Is there a defined way of using add(*) methods through bean properties ?
    Seems a little odd that Swing components can't be added to a container in a simple "bean-like" way....is there a set*(*) method I've missed ? I'm aware of the getComponents() method on Container...but there's no setComponents(Component []) method.
    Thanks,
    Michael.

    Thank you for the repsonse....but..
    Wouldn't that mean that I'd have to sub-class all the Components I wanted to use....just to add the set*(*) method....isn't there a tidier way ?
    I really find this strange...(I can think of many examples where accessing the add*(*) methods through introspection (possibly by providing set*(*) methods) would be extremely useful....but, staying in a Swing context....)
    If you wanted to create an application that can load, edit and save GUI forms (as many already have). Having all Swing components stick to the javaBeans spec. is very useful. The application can use introspection to grab all the properties of a component, without having any hard-coded logic on dealing with specific classes. Users can then provide their own extensions to the components palette, and by sticking to the javaBeans convention, have the GUI editor expose those properties.
    But....to compose components together (a fundamental concept) the editor must be provided with "hard-coded" logic that knows how to deal specifically with Components (in that they have an add(*) method).
    This must also be a problem with the XMLDecoder class ?!
    When encoding a Swing component, the XMLEncoder can use all the get*() methods (including getComponents()) to persist the Container, its properties, and any sub-components....fine.
    But, when decoding this information, all the properties can be set through the usual bean mechanism (using the corresponding setPropertyName(*) method) except the sub-components....there is no setComponents(*) method.
    How does the XMLDecoder get around this problem ?
    Does it "know" that when it gets to the "components" property of a Swing component, it must call the add(*) method instead...?
    Thanks,
    Michael

  • An mp3 file on my computer will not import to itunes by either the drag-and-drop or the Add File to Library method.  Can't figure out what I'm doing wrong.  My OS is Windows 7.

    I purchased an mp3 from a private website on my laptop.  The itunes library i sync ipod to is on my desktop, so i copied the mp3 onto a flash drive and then into my desktop in the Downloads folder and Desktop folder as well as the itunes music folder, 3 places.  I opened itunes on the desktop and read the instructions for importing music that's already in my computer.  Neither the drag-and-drop or the Add File to Library method works.  I've tried both ways over and over.  Cannot figure out what the problem is.  I do note that the name of the mp3 file doesn't show the .mp3 extension, it appears as simply it's title, Eating Healthy, without any extension at all.  Could the filename be the problem, or do you have any other idea what I'm doing wrong?  My OS is Windows 7, using IE9.  Thanks.
    ADDENDUM AFTER READING ANOTHER DISCUSSION HERE:  I have now tried right clicking the song in Windows Explorer and choosing Open With, clicking itunes.  The mp3 plays in itunes but does not add to the library.

    I don't have a Recently Added playlist.  However, I discovered that the file I had named Eating Healthy was given the name You Can Enjoy Eating Healthy when it copied to iTunes.  I'm guessing iTunes pulled the full name of the piece from the internet.  Upshot--the mp3 did transfer to iTunes on all 3 tries, but I was looking in my alphabetized list under E, not Y, so I didn't see it there.  Thanks for your help. 

  • An April fool subject - fooling around the collections add method

    Here is a situation of an application business logic:
    A user can only add one feedback to a comment. I try to define how a feedback can be added into a comment by redefining the equal and hashCode methods.
    public class Feedback implements Serializable {
         public enum VALUE {
              NEGATIVE, POSITIVE
         protected Integer id;
         private Comment comment; // refer to a comment
         private User user;     // who gives this feedback
         private VALUE value;
         @Override
         public int hashCode() {
              final int prime = 31;
              int result = 1;
              result = prime * result + ((comment.id == null) ? 0 : comment.id.hashCode());
              result = prime * result + ((user == null) ? 0 : user.hashCode());
              return result;
          * (non-Javadoc)
          * @see java.lang.Object#equals(java.lang.Object)
         @Override
         public boolean equals(Object obj) {
              if (this == obj)
                   return true;
              if (obj == null)
                   return false;
              if (getClass() != obj.getClass())
                   return false;
              CommentFeedback other = (CommentFeedback) obj;
              if (comment.id == null) {
                   if (other.comment.id != null)
                        return false;
              } else if (!comment.id.equals(other.comment.id))
                   return false;
              if (user == null) {
                   if (other.user != null)
                        return false;
              } else if (!user.equals(other.user))
                   return false;
              return true;
          public class Comment {
             private Set<CommentFeedback> feedbacks;
               private transient short totalFeedbacks;
             private transient short positiveNumber;
             private transient short negativeNumber;
         public boolean addFeedback(CommentFeedback fb){
              boolean added = this.getFeedbacks().add(fb);
              if(added){
                   this.totalFeedbacks++;
                   if(fb.getValue() == CommentFeedback.VALUE.POSITIVE)
                        this.positiveNumber++;
                   else
                        this.negativeNumber++;               
              return added;
         }I don't get the expected behavior. A feedback with the same comment and user of an existing one in the feedback collection of the comment classs can be added into the collection. Anything is missing here?

    BigDaddyLoveHandles wrote:
    For starters, you can clean up equals with a helper method:
    public boolean equals(Object obj) {
    if (this == obj)
    return true;
    if (obj == null)
    return false;
    if (getClass() != obj.getClass())
    return false;
    Feedback other = (Feedback) obj;
    return
    equals(id, other.id) &&
    equals(comment, other.comment) &&
    equals(user, other.user) &&
    equals(value, other.value);
    public static boolean equals(Object a, Object b) {
    return a==null ? b==null : a.equals(b);
    What is wrong the equal method, then?
    Second, should equality depend on id?
    Third, your equality depends on comment's id, not on comment's equality.
    Fourth, you don't consider field value.Why not? The comment entity id is unique. Any other fields don't need to be considered for the reason I mentioned in the question (the first poster).
    [Recommend and review web sites|http://homepage.kgbinternet.com] - a fresh approach of building an open source, useful, and dynamic web site directory
    Edited by: vwuvancouver on Apr 17, 2009 9:01 AM

  • I cannot figure out how to make the text larger on an incoming email.  The finger method doesn't work and I cannot find any toolbar with which to do it.  I could find nothing in settings also.  Plese help and thank you.

    I cannot figure out how to make the text larger in a received email.  The finger method doesn't work and I can find no tool bar as I can for composing emails.  I can find nothing in settings.  Please help and thank you in advance.

    Hi there,
    Download a piece of software called TinkerTool - that might just solve your problem. I have used it myself to change the system fonts on my iMac. It is software and not an app.
    Good wishes,
    John.

  • Suddenly in both ff 3.6 and beta 4 all of my add-ons are gone; they are all listed on the add-on page but they are not on the browser--help!

    One day when I opened ff all the add-ons had disappeared. I've uninstalled ff and re-installed. I've installed beta 4. I've uninstalled some of the add-ons and re-installed them...nothing makes a difference. I tried deleting extension configuration files in case they were corrupt (per support page)...no help. I'm using Chrome right now but I want my firefox back, I miss it so! Can anyone help me?

    Delete the files extensions.* (extensions.rdf, extensions.cache, extensions.ini, extensions.sqlite) and compatibility.ini in the Firefox [[Profiles|profile folder]] to reset the extensions registry. New files will be created when required.
    See "Corrupt extension files": http://kb.mozillazine.org/Unable_to_install_themes_or_extensions
    If you see disabled, not compatible, extensions in "Tools > Add-ons > Extensions" then click the "Find Updates" button (in Firefox 4: right-click the extension -> "Find Updates") to do a compatibility check.
    See also http://kb.mozillazine.org/Corrupt_localstore.rdf

  • HT1473 Help I just moved my music files to a external hard drive and am using the new crappy version ( i know my opinion) of itunes and cant add the files to my libray it gives me the add file to library option but not the add folder to library option wha

    Help I just moved my music files to a external hard drive and am using the new crappy version ( i know my opinion) of itunes and cant add the files to my libray it gives me the add file to library option but not the add folder to library option what am i doing wrong?

    In iTunes 11 uncheck the preferences setting in in the iTunes Preferences panel "Advanced > Copy Files to iTunes Media folder when adding to Library"

Maybe you are looking for