collection « algorithm « Java Collection Q&A

Home
Java Collection Q&A
1.algorithm
2.array
3.Array Byte
4.Array Char
5.Array Convert
6.Array Dimension
7.Array Integer
8.Array Object
9.Array String
10.ArrayList
11.collection
12.comparator
13.Development
14.Garbage Collection
15.Generic
16.hash
17.HashMap
18.HashTable
19.iterator
20.LinkedList
21.List
22.Map
23.queue
24.Set
25.Sort
26.tree
Java Collection Q&A » algorithm » collection 

1. best way to pick a random subset from a collection?    stackoverflow.com

I have a set of objects in a Vector from which I'd like to select a random subset (e.g. 100 items coming back; pick 5 randomly). In my first (very hasty) ...

2. Java: Efficient Equivalent to Removing while Iterating a Collection    stackoverflow.com

We all know you can't do this:

for (Object i : l)
    if (condition(i)) l.remove(i);
ConcurrentModificationException etc... this apparently works sometimes, but not always. Here's some specific code:
public static void ...

3. Java: How to remove elements from a list while iterating over/adding to it    stackoverflow.com

This question is a more special case of the problem described (and solved) in this question. I have two methods, stopAndRemove(ServerObject server) and a close() method. The later should close all ...

4. Problem with printing inside the loop: for    stackoverflow.com

I have problem reading/println after the first two FOR loop in this method. This is strange. How can I solve this problem?

private int spacing() {
 int n = numberOfTriangles();

 ...

5. how to handle large lists of data    stackoverflow.com

We have a part of an application where, say, 20% of the time it needs to read in a huge amount of data that exceeds memory limits. While we can ...

6. Java: Implementing "repeat until no change" collection    stackoverflow.com

I'm trying to implement an algorithm that repeatedly applies operations on a Collection (currently a List). In each step Elements can be added, removed and changed (using getters and setters) within ...

7. Efficient algorithm for detecting different elements in a collection    stackoverflow.com

Imagine you have a set of five elements (A-E) with some numeric values of a measured property (several observations for each element):

A = {100, 110, 120, 130}
B = {110, 100, 110, ...

8. Is Collections.shuffle suitable for a poker algorithm?    stackoverflow.com

there is a poker-system in java, that uses Collections.shuffle() on all available cards before the cards are dealt. So a collection of 52 cards 2-9, J, Q, K, A in 4 types. After ...

9. Find a large collection of strings within a larger collection of strings    stackoverflow.com

I have a collection of strings that I want to filter. They'll be in this pattern:

xxx_xxx_xxx_xxx
so always a sequence of letters or numbers separated by three underscores. The max length of ...

10. Collections.binarySearch() vs. List indexOf()    stackoverflow.com

I have a list of more than 37K items, and I already implemented hashCode(), equals(), so I wonder Collections.binarySearch() can help improve the performance and faster than indexOf() method.

11. Set time and speed complexity    stackoverflow.com

I am brushing up algorithms and data structures and have a few questions as well as statements I would like you to check. ArrayList - O(1) (size, get, set, ...), O(n) - ...

12. More efficient way to find all combinations?    stackoverflow.com

Say you have a List of Strings or whatever, and you want to produce another List which will contain every possible combination of two strings from the original list (concated together), ...

13. Recognize sets of numbers in collection of sets    stackoverflow.com

I have a collection of sets with numbers in it. Say

A = {-2, 5, 6, 8}  
B = {-2, 4}  
C = {-2, 4, 6, 8}  ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.