// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.testsystems.fit;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class SocketDealer {
  private Map<Integer, SocketSeeker> waitingList = new HashMap<Integer, SocketSeeker>(17);
  private int ticketCounter = 1;

  public int seekingSocket(SocketSeeker seeker) {
    int ticket = ticketCounter++;
    waitingList.put(new Integer(ticket), seeker);
    return ticket;
  }

  public Collection<SocketSeeker> getWaitingList() {
    return waitingList.values();
  }

  public void dealSocketTo(int ticket, SocketDoner doner) throws Exception {
    Integer key = new Integer(ticket);
    SocketSeeker seeker = waitingList.get(key);
    seeker.acceptSocketFrom(doner);
    waitingList.remove(key);
  }

  public boolean isWaiting(int ticket) {
    return waitingList.containsKey(new Integer(ticket));
  }
}

@@ -508,35 +508,22 @@
 ist.put(
-new Integer(
 ticket
-)
 , seeker
@@ -721,47 +721,8 @@
 n %7B%0A
-    Integer key = new Integer(ticket);%0A
     
@@ -759,19 +759,22 @@
 ist.get(
+tic
 ke
-y
+t
 );%0A    s
@@ -831,11 +831,14 @@
 ove(
+tic
 ke
-y
+t
 );%0A 
@@ -921,28 +921,15 @@
 Key(
-new Integer(
 ticket)
-)
 ;%0A  

Remove inefficient boxing of int.