Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #3764

Re: Concurrent bidirectional one-to-many map?

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sat, 07 May 2011 08:40:57 -0500
Date Sat, 07 May 2011 06:40:55 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Concurrent bidirectional one-to-many map?
References <iq1kf0$ee2$1@news.albasani.net> <iq1mmc$hbv$1@dont-email.me> <iq348b$iv1$1@news.albasani.net>
In-Reply-To <iq348b$iv1$1@news.albasani.net>
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <nsadnUZcjoF01ljQnZ2dnUVZ_gednZ2d@earthlink.com> (permalink)
Lines 27
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 75.8.126.96
X-Trace sv3-8ah/mxyb8IvQted1uK6hQcqbngzi32mYzir4ppWSHjz1bMPyhbP7/2qKR+3X+Jz+gfeUxNbUTysw+4s!x72tOajfK+KX5lKlLwIznJ41DvWyskGxfELpRmqqz6xoTUy74Hyafp+ZXwez3JmG3rULjZyLc8es!aF2IDXxnXwzsMpFcjFt0OM1eGnOIgfzXdNOmpBwDrXY=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2133
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3764

Show key headers only | View raw


On 5/7/2011 2:43 AM, Sebastian wrote:
...
> To give an example, I'm trying to solve a problem like this:
> Associate tasks with workspaces, where a workspace may hold many
> tasks,but a task may be associate with at most one workspace.
...

I'd deal with that sort of problem by having a custom data structure
that uses java.util structures in its implementation.

For example, class TaskMapping could have a Map<Task,Workspace> that
maps a task to its workspace, and a Map<Workspace,Set<Task>> that maps a
workspace to the set of tasks it currently holds.

TaskMapping would have methods such as:

add(Task t, Workspace w)
remove(Task t, Workspace w)
Iterable<Task> getTasks(Workspace w)

To the rest of the program it looks like a unified data structure, but
each operation uses a data structure that is well suited to the types of
access it does.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-06 22:07 +0200
  Re: Concurrent bidirectional one-to-many map? markspace <-@.> - 2011-05-06 13:45 -0700
    Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-07 11:43 +0200
      Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-07 07:59 -0400
        Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-07 12:49 -0400
          Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-07 21:34 +0200
      Re: Concurrent bidirectional one-to-many map? Patricia Shanahan <pats@acm.org> - 2011-05-07 06:40 -0700
        Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-08 04:51 +0100
          Re: Concurrent bidirectional one-to-many map? Robert Klemme <shortcutter@googlemail.com> - 2011-05-09 06:43 -0700
            Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-09 18:28 +0100
              Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-09 22:57 +0200
                Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-09 18:36 -0400
                Re: Concurrent bidirectional one-to-many map? Tom Anderson <twic@urchin.earth.li> - 2011-05-10 08:34 +0100
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 10:09 +0200
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 10:51 +0200
                Re: Concurrent bidirectional one-to-many map? Robert Klemme <shortcutter@googlemail.com> - 2011-05-11 04:55 -0700
                Re: Concurrent bidirectional one-to-many map? Lew <noone@lewscanon.com> - 2011-05-11 09:00 -0400
                Re: Concurrent bidirectional one-to-many map? Sebastian <sebastian@undisclosed.invalid> - 2011-05-11 20:47 +0200
      Re: Concurrent bidirectional one-to-many map? markspace <-@.> - 2011-05-07 09:35 -0700
      Re: Concurrent bidirectional one-to-many map? Michal Kleczek <kleku75@gmail.com> - 2011-05-09 16:42 +0200
  Re: Concurrent bidirectional one-to-many map? Roedy Green <see_website@mindprod.com.invalid> - 2011-05-07 03:46 -0700

csiph-web