Search Results

Search found 4 results on 1 pages for 'user288245'.

Page 1/1 | 1 

  • Hashtable comparator problem

    - by user288245
    Hi guys i've never written a comparator b4 and im having a real problem. I've created a hashtable. Hashtable <String, Objects> ht; Could someone show how you'd write a comparator for a Hashtable? the examples i've seen overide equals and everything but i simply dont have a clue. The code below is not mine but an example i found, the key thing in hashtables means i cant do it like this i guess. public class Comparator implements Comparable<Name> { private final String firstName, lastName; public void Name(String firstName, String lastName) { if (firstName == null || lastName == null) throw new NullPointerException(); this.firstName = firstName; this.lastName = lastName; } public String firstName() { return firstName; } public String lastName() { return lastName; } public boolean equals(Object o) { if (!(o instanceof Name)) return false; Name n = (Name)o; return n.firstName.equals(firstName) && n.lastName.equals(lastName); } public int hashCode() { return 31*firstName.hashCode() + lastName.hashCode(); } public String toString() { return firstName + " " + lastName; } public int compareTo(Name n) { int lastCmp = lastName.compareTo(n.lastName); return (lastCmp != 0 ? lastCmp : firstName.compareTo(n.firstName)); } }

    Read the article

  • Starting Javascript

    - by user288245
    Hi guys, a couple of questions (never done javascript before). Below is part of the what happens on submit, what is something, the action, the php script its sent to? Also is there any software you guys reccomend for checking you're javascript, like the equivalent of an ide? im using notepad++. Is the rest the right sort of idea? I'm using several else ifs for each method, checking valid == true. <SCRIPT LANGUAGE="JavaScript"> <form action="something" onsubmit="return ok()"> function ok() { if (validate_Info() == false) { alert('Please enter a name'); return false; } else if else if

    Read the article

  • Web technologies exam query

    - by user288245
    I have a practical exam in web technologies so html, css, javascript and (possibly) php. I'm still learning and just wondered if you guys had any advice. HTML im fine with, css sometimes takes me time to get right and javascript and php get a bit messy! It's open book, so what would you suggest taking with me?

    Read the article

  • Describing Types question

    - by user288245
    I have a bunch of types (eg. LargePlane, SmallPlane) that could be in this collection i've made, how do i print like LargePlane? I've tried like typeOf() and stuff but it doesn't work. Within like a toString()? So when i output the collection it states what type it is.

    Read the article

1