public void TryDelete(T item) { lock (@lock) { collection.Remove(item); } }
public static void Main() { var test = new HashedLinkedList <int>(); for (var i = 0; i < 33; i++) { test.Add(i); } // Fails after 7 removals for (var i = 0; i < 33; i++) { Console.WriteLine(i); test.Remove(i); } // Fails after 23 removals for (var i = 32; i >= 0; i--) { Console.WriteLine(i); test.Remove(i); } }
public void SetCurrentRendezvousServer(RendezvousEndpoint currentRendezvousServer) { lock (@lock) { for (var i = 0; i < config.Count; i++) { var server = config[i]; if (server.Equals(currentRendezvousServer)) { config.Remove(server); config.InsertFirst(server); } } } }
public static void Main(String[] args) { HashedLinkedList<int> test = new HashedLinkedList<int>(); for (int i = 0; i < 33; i++) { test.Add(i); } // for // Fails after 7 removals for (int i = 0; i < 33; i++) { Console.WriteLine(i); test.Remove(i); } // for // Fails after 23 removals // for (int i = 32; i >= 0; i--) { // Console.WriteLine(i); // test.Remove(i); // } // for }
public bool SetCurrentRendezvousServer(RendezvousEndpoint newRendezvousServer) { lock (@lock) { for (var i = 0; i < config.Count; i++) { var server = config[i]; server.RefreshUri(); if (server.Equals(newRendezvousServer)) { config.Remove(server); config.InsertFirst(server); return(true); } } return(false); } }
public static void Main(String[] args) { HashedLinkedList <int> test = new HashedLinkedList <int>(); for (int i = 0; i < 33; i++) { test.Add(i); } // for // Fails after 7 removals for (int i = 0; i < 33; i++) { Console.WriteLine(i); test.Remove(i); } // for // Fails after 23 removals // for (int i = 32; i >= 0; i--) { // Console.WriteLine(i); // test.Remove(i); // } // for }
public void Remove(IDestination destination) => destinations.Remove(destination);