Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2729
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jeff Higgins <jeff@invalid.invalid> |
| Newsgroups | comp.lang.java.help |
| Subject | Re: using TreeMap how to return the Object ? |
| Date | Thu, 27 Jun 2013 13:15:51 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 116 |
| Message-ID | <kqhrjo$u2d$1@dont-email.me> (permalink) |
| References | <f11f9858-f870-42af-a3a3-e9fdb945ba41@googlegroups.com> <kqhkq6$k8g$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 27 Jun 2013 17:09:12 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="6b9e92482af47766954d85fb77d372f5"; logging-data="30797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kfN5wTwzJR3uwDY/NqX0prPPfyVa++Lg=" |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130529 Icedove/17.0.5 |
| In-Reply-To | <kqhkq6$k8g$1@dont-email.me> |
| Cancel-Lock | sha1:DdBqm7E013SwVokcnY6oY/FuUgA= |
| Xref | csiph.com comp.lang.java.help:2729 |
Show key headers only | View raw
On 06/27/2013 11:19 AM, Jeff Higgins wrote:
> On 06/27/2013 01:30 AM, moonhkt wrote:
>> Hi All
>>
public class HostsTest {
private final Hosts hosts;
{ hosts = new Hosts(); }
public static void main(String[] args) {
HostsTest test = new HostsTest();
test.fillHosts("\\etc\\hosts");
}
public boolean fillHosts(String filename) {
/*
* TODO
*/
return false;
}
public Host getHost(IPAddress address) {
/*
* TODO
*/
return null;
}
}
public class IPAddress implements Comparable<IPAddress> {
/*
* IPV4 addresses are 32 bit values
* IPV6 addresses are 128 bit values
* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
// some private final field to hold your address value.
// some constructor(s)
@Override
public int compareTo(IPAddress address) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int hashCode() {
// TODO Auto-generated method stub
return super.hashCode();
}
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
return super.equals(obj);
}
@Override
public String toString() {
// TODO Auto-generated method stub
return super.toString();
}
}
import java.util.ArrayList;
import java.util.List;
public class Host {
private final String hostName;
private final List<String> aliases;
{ aliases = new ArrayList<String>(); }
public Host(String hostname) {
hostName = hostname;
}
/*
* TODO
*/
}
import java.util.Map;
import java.util.TreeMap;
public class Hosts {
private final Map<IPAddress, Host> map;
{ map = new TreeMap<IPAddress, Host>(); }
public Host getHostFromIPAddress(IPAddress address) {
/*
* TODO
*/
return null;
}
}
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
using TreeMap how to return the Object ? moonhkt <moonhkt@gmail.com> - 2013-06-26 22:30 -0700
Re: using TreeMap how to return the Object ? Jeff Higgins <jeff@invalid.invalid> - 2013-06-27 11:19 -0400
Re: using TreeMap how to return the Object ? Jeff Higgins <jeff@invalid.invalid> - 2013-06-27 13:15 -0400
Re: using TreeMap how to return the Object ? Jeff Higgins <jeff@invalid.invalid> - 2013-07-01 10:49 -0400
Re: using TreeMap how to return the Object ? Lew <lewbloch@gmail.com> - 2013-06-28 10:42 -0700
Re: using TreeMap how to return the Object ? Patricia Shanahan <pats@acm.org> - 2013-06-28 19:13 -0700
Re: using TreeMap how to return the Object ? Gene Wirchenko <genew@telus.net> - 2013-07-01 14:16 -0700
csiph-web