I would like to get subsets of elements of a Java List by specifying some of their parameters. Each element has different characteristics, e.g. x-position, y-position, width, height and type. Now I want to get all elements, which position is in a specific interval, or which width or height is not greater than a given value, or which type equals some String.  My actual solution is, that I wrote a bunch of subset()-functions to apply in each different case.   public List&lt;Element&gt; subsetByPositionX(     List&lt;Element&gt; elements, int minX, int maxX) { /*...*/ }  public List&lt;Element&gt; subsetByPositionY(     List&lt;Element&gt; elements, int minY, int maxY) { /*...*/ }  public List&lt;Element&gt; subsetByMaxWidth(     List&lt;Element&gt; elements, int maxWidth) { /*...*/ }  // some more subset methods for height and width  public List&lt;Element&gt; subsetByType(     List&lt;Element&gt; elements, String... types) { /*...*/ }   I'm a bit unlucky about this, because it is not very generic. Is there a more elegant way to subset elements by different kinds of characteristics?
I want to filter a java.util.Collection based on a predicate.
Short description of the scoping rules? Interprocess communication in .NET I have a core .NET application that needs to spawn an abitrary number of sub processes. These processes need to be able to access some form of state object in the core application.  What is the best technique? I'll be moving a large amount of data between processes (Bitmaps), so it needs to be fast. Tips to extend battery life for laptops and notebooks Should the first word after a colon be capitalized? Should the first word after a colon be capitalized? Which of the following is correct?   For example: This. For example: this. Why can Naruto still use Rasenshuriken? In this kind of sentence the second half is an inversion of the first half. Is it a rhetorical artífice? What kind? Question Tag problem! Question:     A man like you should not do this, _______?   Which question tag should I use in the blank space?   should he? should you?   Which would be grammatically correct? I think 1 is true. Is it possible to modify the title of the message box the confirm() function opens in JavaScript?   I could create a modal popup box, but I would like to do this as minimalistic as possible. I would like to do something like this:  confirm("This is the content of the message box", "Modified title");   The default title in Internet Explorer is "Windows Internet Explorer" and in Firefox it's "[JavaScript-program]." Not very informative. Though I can understand from a browser security stand point that you shouldn't be able to do this. Retrieving Data from remote database Is "mens" a valid word? I've been living in Ireland for almost a year now and I start noticing they use the word "mens" a lot. I can see it used in:   Shops, to denote the area where you can find men's clothes In sport, when they talk about "mens team".    My guess is just that they are lazy about the use of quotes, so that mens should actually be men's. However, there may be some rule I'm not aware of. So, is "mens" only limited to Irish English? When I'm allowed to use it? How to vertically center content with variable height within a div? What is the best way to vertically center the content of a div when the height of the content is variable.  In my particular case, the height of the container div is fixed, but it would be great if there were a solution that would work in cases where the container has a variable height as well. Also, I would love a solution with no, or very little use of CSS hacks and/or non-semantic markup. How to check if a thread is sleeping? I was thinking about writing a partial derivative macro that has a similar syntax to the . ()  The syntax could be like this:   \D{f}{x} expands to \frac{\partial f}{\partial x} \D{f}{x,y} expands to \frac{\partial^2 f}{\partial x\,\partial y} \D{f}{{x,2},y} expands to  \frac{\partial^3 f}{\partial x^2\,\partial y} et cetera for any number of derivatives.   Bonus points for an optional argument so that for instance   \D[subscript]{f}{{x,2},y} expands to f_{xxy}   I looked at the  package but the syntax is a little tedious.  For instance, to get \frac{\partial^3 f}{\partial x^2\,\partial y} with that package I would need to do \md{f}{3}{x}{2}{y}{}.  And it doesn't generalize to three variables.  Before I dive in I thought I'd ask the hive and see what's been done. Can I start a new Clash of Clans village on my iPhone separate from my account on my iPad? If I download Clash of Clans on my iPhone, can I start a new village despite my account on my iPad? I want to make a village for my younger brother. How to embed fonts in HTML? I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have seen , which doesn't even work on Firefox, and . The second solution is for titles only. Is there a solution available for full text? I'm tired of the standard fonts for web pages.  Thanks! How does one add boarding passes to Apple Wallet? Prove there are no other solutions of functional equation $f(x+y) = \frac{f(x)+f(y)}{1-f(x)f(y)}$ List of interesting math videos / documentaries This is an offshoot of the question on . I have listed a few videos/documentaries I have seen. I would appreciate if people could add on to this list.  $1.$ Story of maths      $2.$ Dangerous Knowledge    $3.$   $4.$   $5.$ Efficient Way to store images in android Lately I've been seeing this cookie popup that blocks a lot of the screen.  When I try to do the &quot;manage cookies&quot; thing, all it shows me are several categories, with a green oval containing a black circle to the right of each.  Clicking on that oval makes it disappear.  Clicking on the same spot again makes it reappear.  But I see no indication as to which state is off or on. So how can I make this popup go away, never to bother me again?  Or failing that, could you at least provide some indication as to what those buttons do?  Like maybe simple text saying &quot;Off&quot; or &quot;On&quot;?