I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth.    A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas.  Surely, I can write a custom method that finds those Cats with a specific property, but this gets cumbersome with many properties; is there some generic way of doing this?
I want to filter a java.util.Collection based on a predicate.
Using beamer \visible command inside a table, without adding vertical space When using the beamer \visible command inside a tabular environment, beamer adds an extra vertical space before the text. For example, in the following code, beamer adds an empty line before the word World in the second row. Can this be avoided?  \documentclass{beamer} \begin{document} \begin{frame}   \begin{tabular}{|p{1cm}|p{1cm}|}     \hline     1 &amp; Hello World \\     \hline     2 &amp; \visible&lt;2-&gt;{Hello World} \\     \hline   \end{tabular} \end{frame} \end{document} For , the answer given on 7 Feb about how to edit the subject line in the new format of Gmail does not work for me.   There is no box on the left with a down arrow to options to reply, forward or edit subject in my version. There is a book on the right offering options to    Reply Reply to all Forward Filter message Print Delete Report spam Report phising Show original Message text garbled Translate message Mark answered    But, no option to edit subject Is there an infinite amount of wavelengths of light? Is the EM spectrum continuous? The electromagnetic spectrum is a continuum of wavelengths of light, and we have labels for some ranges of these and numerical measurements for many.  Question: Is the EM spectrum continuous such that between two given wavelengths (e.g. 200nm and 201nm) there is an infinite number of distincts wavelengths of light?  Or is there some cut-off of precision with which light might exist (e.g. can light only have wavelengths of whole number when measured in nanometers, etc.)? I had a bunch of errors in the output of sudo apt-get update:  duplicate entries and 404 not found errors.  Figured those out, I hope: I removed PPAs that didn't have any packages associated with them, then I removed out a duplicate entry in /etc/apt/sources.list.  It seems I have royally buggered it up.  Now most of the lines say Ign when I do sudo apt-get update.  How do I go about straightening out what I have screwed up?  I need to get rid of these Igns that are all over the place.  There are about 50% (eyeball guess) Igns! Avoiding numerical cancellation question for $\sin x -\sin y$ for $x \approx y$ When trying to avoid cancellation, one tries to reformulate the equation in order to avoid subtraction between almost equal terms.   In $\sin (x) - \sin (y), x \approx y$ the suggested solution is to reformulate it to $$2\cos\left(\frac{x+y}{2}\right)\sin\left(\frac{x-y}{2}\right)$$  But I don't understand how it is any better? The subtraction between $x, y$ remains. Is it because $\lvert\,\sin(x)-\sin(y)\,\rvert\leq \lvert\,x-y\,\rvert$, so cancellation is less likely to happen between $x,y$ than the sines? Whenever I create a document in Microsoft Word, it complains about a lot of my sentences being in passive voice. But, when I read that sentence aloud, it sounds fine to me. I am not sure if it is just me and will a statement in passive voice sound strange to a native speaker?  So, my question is, is it considered bad form to use passive voice generally? Or in some specific cases like written communications only?  Edit: If it is ok to use passive voice, then why does MS-Word complain? Are the leftovers from making stock good for anything? Having made stock and strained it, can the meat and vegetables boiled up in the stock be used for anything, or should they go in the bin? In a reverse split, what happens to odd lots? Let us say for example that I have 27 shares of stock X (there really is an X but its identity is not relevant).  In this example, X does a 5:1 reverse split. How many shares do I end up with. If I have fractional shares, what can I do with them? When is it better to use String.Format vs string concatenation? Derivative of an even function is odd and vice versa Hat duplicates when info is expanded It seems like there is a bug that is causing a duplicate hat to appear when I expand info, like pressing &quot;(more)&quot; on a suggested edit. This bug does not seem to be specific to the suggested edits review queue though, as others have reported seeing this bug in other places, like code snippet expansion. Steps to repro:  Put on a hat. Navigate to one of your own suggested edits. (You can just also open the Suggested Edits review queue and go to a random suggestion, but there is no guarantee any of those users will be wearing a hat.) Click the &quot;(more)&quot; button to expand the top box.  What should happen: Hat should shift down with the rest of the content. What happens: All the content shifts down, but a duplicate hat remains in the initial place. Before expansion:  After expansion with duplicate hat: What is the best technique to calculate a confidence interval of a binomial experiment, if your estimate is that $p=0$ (or similarly $p=1$) and sample size is relatively small, for example $n=25$? Fail of markdown parser detected if '_ 's are used in a naked URL In the answer , the parser breaks my URL link.  The URL was with __word__:      http://www.open-mpi.de/projects/hwloc/doc/v1.2/group__hwlocality__membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd   After parsing, it becomes (&lt;a href is broken; no clickable link):  hwlocality_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd"&gt;http://www.open-mpi.de/projects/hwloc/doc/v1.2/group_hwlocality_membinding.php#gade5e2c28ea8475a479bf2b1df36c6ccd   Short test:  http://example.com/_test_ -> test"&gt;http://example.com/test  Or if I put in a naked URL with _test_ just here: Is it possible to grant rename permissions, but not delete, in NTFS? We have a folder for employees to scan contracts to. After scanning, they're supposed to rename them according to our conventions so they can be processed further. In response to a recent incident, these folders have had their security locked down (they're granted write, but not modify, permission) and now they are unable to rename the files.  Is there a technical way to accomplish what I'm trying to do? From what I've read, I don't think this is possible.  If not, can you suggest any workarounds? One possibility is to set the name of the file as it's being scanned in. Another is to have a trusted person in management be given sufficient permissions to rename. I often need to make banner sets that consist of anywhere from 6-14 different sized banners. A lot of these banners have the same text (which I put in smart objects to work faster) and the same or different images. The placement and sizes of these elements differ according to the banner size though.  I find the process of 'copying' the content from one artboard to another to go a bit slower than I'd like it to. I can't simply copy/paste, I have to duplicate the layer and then drag it to the right artboard in the layer panel. Hoping I have closed all my folders or else I have to drag miles upwards ;)   There has to be a better way! Why can't I simply copy paste a layer anymore? I'm pretty sure this used to be the case in older versions of photoshop. Adding a Method to an Existing Object Instance I tried:   Launching Ubuntu Software Centre I typed in "air" and found "adobe air" It says "available from the 'maverick-partner' source. and has a button "use this source" I clicked "use this source", I saw a "in progress (1)" icon come up in the side bar, and disappear, but nothing happened/changed.   I'm stuck.  I have actually already added the maverick-partner source to apt so I could install sun-java6-jdk. Replacements for switch statement in Python? I want to write a function in Python that returns different fixed values based on the value of an input index.    In other languages I would use a switch or case statement, but Python does not appear to have a switch statement.  What are the recommended Python solutions in this scenario? Why can't I import "pygtk" with Python 3.2 from PyDev? Which is correct: "has died" or "died"? To me, using Present Perfect form means the event can occur again. So, saying      someone has died   may not be grammatically correct.  Also, I noticed (it might be just coincidence):     passed away   is used more often than     has passed away   Is using Present Perfect correct here?