What is the most efficient way to do this ?   I have a  ArrayList list called windowList.   GameWindow is bean having startTime and endTime.  For each object i recieve, I need to check the window of the object belongs to any of this windowList values. I need to do it for millions of values.  Please help me with most effeftive way to do this ....
I have an ArrayList of objects in Java.  The objects have four fields, two of which I'd use to consider the object equal to another.  I'm looking for the most efficient way, given those two fields, to see if the array contains that object.  The wrench is that these classes are generated based on XSD objects, so I can't modify the classes themselves to overwrite the .equals.    Is there any better way than just looping through and manually comparing the two fields for each object and then breaking when found?  That just seems so messy, looking for a better way.  Edit: the ArrayList comes from a SOAP response that is unmarshalled into objects.
Prove $f(S \cup T) = f(S) \cup f(T)$ $f(S \cup T) = f(S) \cup f(T)$  $f(S)$ encompasses all $x$ that is in $S$ $f(T)$ encompasses all $x$ that is in $T$  Thus the domain being the same, both the LHS and RHS map to the same $y$, since the function $f$ is the same for both.  Can you post the solution? Overriding "+=" in Python? (__iadd__() method) Let $a\ge1$ and define the sequence $(x_n)$ recursively by: $$x_1 = \sqrt{a}$$ $$x_{n+1}= \sqrt{a+x_n}$$  Here's what I did:  Plugging in some values makes it seem as if the sequence is increasing. I first solve the equation $t=\sqrt{a+t}$, equivalently $t^2 -t -a =0$, to get an idea what's going on. The roots are $$t_{1,2}= \frac{1 \pm \sqrt{1+4a} }{2}.$$ Therefore, between the roots, that is for $$t\in \left( \frac{1 - \sqrt{1+4a} }{2}, \frac{1 + \sqrt{1+4a} }{2}\right)$$  we have $t^2-t-a \le 0 \iff t \le \sqrt{a+t}$. Here's my attempt at showing inductively that $$\forall n\in \mathbb{N}, \ x_n \le \frac{1 + \sqrt{1+4a} }{2}$$  For $n=1$, the statement is true (simple arithmetic). Suppose it's true for $n$. Consider  $$x_{n+1}= \sqrt{a+x_n}\le \sqrt{a+\frac{1 + \sqrt{1+4a} }{2}}=\frac{1 + \sqrt{1+4a} }{2},$$  because $\frac{1 + \sqrt{1+4a} }{2}$ satisfies $x=\sqrt{x+a}$.  So this establishes the sequence $(x_n)$ is bounded. Now, by induction again, I try to show it's monotonically increasing. The base case $x_1\le x_2$ is obvious. Assume (strong induction) $x_{n-1}\le x_n$ for all $n&gt;1$. But since we have $$x_1\le x_n \le \frac{1 + \sqrt{1+4a} }{2}, $$   then $x_n$ lies in the appropriate interval, so $x_n \le \sqrt{a+x_n}=x_{n+1}.$  Is this proof correct? Can the condition on $a$ be relaxed to $a&gt;0$? Maybe even small negative $a$? And could someone provide me with another proof of convergence of $x_n$? I absolutely hate this one! Is it possible to add entries to the bibliography based on keyword using Biblatex/Biber and within the document code? I would like to print a bibliography which includes all entries with a certain keyword (and possibly some additional entries).  I know that I can filter by keyword when I print the bibliography using  \printbibliography[keyword=&lt;keyword&gt;]   but this will only print entries which I have cited. I could, of course, use  \nocite{*}   to add all entries to the bibliography and then print just those I want.  However, this will make my .bbl file huge as my database is enormous.  Another possibility is to use Biber or another tool to prepare a document-specific .bib file containing only those entries with the keyword. However, this would need to be recreated if additional entries with the keyword are added to my main database files.  Here's an MWE to play with, annotated to indicate the way I'd like it to work ;), and the disadvantages of the way it (almost) works.  The issue of excluding explicitly cited entries is less of an issue for me. The thing I'd really like to work around is adding the entire database contents to the .bbl.  \RequirePackage{filecontents} \begin{filecontents}{\jobname.bib} @book{new-stuff,     author          =   {Watt, Brian},     title           =   {Happy Times with Penguins},     publisher       =   {Harvard University Press},     address         =   {Cambridge, MA},     year            =   1995,     pagination      =   {section},     keywords        =   {happy}} @book{den-coll,   author                =   {Till, Jr., Dennis E.},     booktitle           =   {Penguin Land and Further North: Human Influence},     title               =   {Penguin Land and Further North: Human Influence},     publisher           =   {Oxford University Press},     year                =   2008,     address             =   {Oxford and New York},     keywords            =   {penguin, human}} @book{old-stuff,   author                =   {Harvey, Jr., Dennis E.},     booktitle           =   {Penguin Land and Further North: Human Influence},     title               =   {Penguin Land and Further North: Human Influence},     publisher           =   {Someone \&amp; Daughters},     year                =   1567,     address             =   {Oxford},     bookpagination      =   {paragraph},     keywords            =   {penguin}} \end{filecontents} \documentclass{article} \usepackage[defernumbers=true]{biblatex} \bibliography{\jobname} \begin{document}  \cite{old-stuff}  % what I would like to work % \nocite[keyword=happy] % \printbibliography  % what does work - except that \cite{old-stuff} is ignored and, more importantly, den-coll is added to the .bbl \nocite{*} \printbibliography[keyword=happy]  \end{document} Use filecontents environment to write a binary file In  of mine, I was trying to show how to embed an audio file into the pdf with the multimedia package. The resulting MWE does not stand on its own because it requires an example audio file.  I guess my first question is, does TeXLive include any example audio files? The second, and potentially less uninteresting question is, can I use the filecontents environment, or some other environment, to create a binary file?  \documentclass{article} \usepackage{graphicx} \usepackage[implicit=false]{hyperref} \usepackage{multimedia}  % What goes in here to produce a usable wav file. Happy to use a different environment. \begin{filecontents}{\jobname.wav} \end{filecontents}  \begin{document} \sound[inlinesound]{\includegraphics{example-image}}{\jobname.wav} \end{document} Why is $\mathbb{Z}[\sqrt{-n}], n\ge 3$ not a UFD? I'm considering the ring $\mathbb{Z}[\sqrt{-n}]$, where $n\ge 3$ and square free. I want to see why it's not a UFD.   I defined a norm for the ring by $|a+b\sqrt{-n}|=a^2+nb^2$. Using this I was able to show that $2$, $\sqrt{-n}$ and $1+\sqrt{-n}$ are all irreducible. Is there someway to conclude that $\mathbb{Z}[\sqrt{-n}]$ is not a UFD based on this? Thanks. How to generate a chirped signal English version of Ubuntu with Italian keyboard I want to install Ubuntu in ENGLISH (UK) but I have an ITALIAN keyboard, which has a different layout to the English keyboard. How can I install Ubuntu in English but select an Italian layout for the keyboard. I tried, but it would only allow me to select an English keyboard. Thanks What is the white smoke-like fog called? How to test a confirm dialog with Cucumber? Windows 7 time issues Why does chmod 777 -R / leave the system unusable? I'm only granting permission to all to do anything but why does the system crash by giving permissions only? I'm only modifying the permission not changing the files. How do you make samba follow symlink outside the shared path This is Ubuntu server 10.04 64 and samba 3.4.7.  I have a shared directory /home/mit/share and another one /home/temp that I link into the shared one:  ln -s /home/temp /home/mit/share/temp   But on windows, after using internet, I cannot open S:/temp, but on Linux it is possible to access /home/mit/share/temp like expected.   This works if I link directories inside /home/mit/share/temp, so I guess samba is restricting to jump with a link outside/above the shared directory.   EDIT:  See also this question titled .  It seems best to put unix extensions = no into the global section and follow symlinks = yes and wide links = yes only into the shares section, where you really need it.  The unix extension flag has to live in the global section and not in the individual shares sections. But for security reasons it is better to use the other options only where you need it, and not globally. Decreasing font size in verbatim New SSD problem I've just installed a new SSD replacing an HDD in my old (late 2008) iMac. When I switched it on all I got on screen was a question mark.   On the advice of my son I tried cmdR during switch on with no result.   I then tried alt which at least got me a cursor on the screen, but nothing else. Any suggestions? I've got everything backed up on an external Hard Drive, by the way. How can I remove a trailing newline? Wanted: question mark instead of bibtex key for missing citations (biblatex) Instead of having the citation key showing up in the document for missing references, I want to only have [?], as it is the case when using the default bibtex without biblatex. This behavior is driving me crazy, as it messes up all the formatting (especially in tables). I want to focus on writing and only later on deal with the erroneous citations.  This question is related to    and its MWE can be used. However, as pointed out beforehand, I want the question mark in the text instead of the citation key to not mess up the formatting (for missing citations). How does Cypher exit/enter the Matrix without an operator? So basically I want to show:  $\aleph_{\alpha}^{\aleph_{1}} = \aleph_{\alpha}^{\aleph_{0}}\cdot2^{\aleph_1}$ , Where $\omega\leq\alpha&lt;\omega_1$  There is a proof that I found;    But I don't understand his proof for the limit case of $\alpha$.  To be more specific, I dont understand why $ \left( \sup_{\omega \le \beta &lt; \alpha} \aleph_{\beta}\right)^{\aleph_1} \le \left( \prod_{\omega \le \beta &lt; \alpha} \aleph_{\beta}\right)^{\aleph_1}$  Any insights or help is deeply appreciated.  Cheers I want to determine whether a multi-line string ends with a line containing specified pattern.  These code failed, it doesn't match.  s=`echo hello &amp;&amp; echo world &amp;&amp; echo OK` [[ "$s" =~ 'OK$' ]] &amp;&amp; echo match