I have a strange class that has a interface object as attribute. What does it mean? public interface Acceptor{     public void accept(Thing thing);     public boolean hasSpace(); }  public class Box{     private final Acceptor acceptor;     public Box(Acceptor acceptor){         this.acceptor = acceptor;      }       public void acceptor(Thing thing){          acceptor.accept(thing);     }         public void hasSpace(){          return acceptor.hasSpace();     } }  Say I want to create an instance of Box, how?
I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this?   I know what interfaces do, but the fact I am not clear on this makes me think I am missing out on using them correctly.   Is it just so if you were to do:  IInterface classRef = new ObjectWhatever()   You could use any class that implements IInterface? When would you need to do that? The only thing I can think of is if you have a method and you are unsure of what object will be passed except for it implementing IInterface. I cannot think how often you would need to do that.   Also, how could you write a method that takes in an object that implements an interface? Is that possible?
Quantum mechanics and everyday nature Is there a phenomenon visible to the naked eye that requires quantum mechanics to be satisfactorily explained? I am looking for a sort of quantic Newtonian apple. What is a plain English explanation of "Big O" notation? Polynomials, prove exercise question about question There is a polynomial P with integer coefficients and with pairwise different integers $a,b,c$ . Prove that it is not possible for $P(a) = b$, $P(b)=c$, $P(c) = a$  First off I don't understand "pairwise different" part - what does it mean ,can you show me this as an equation? After that I'd like to get a hint in case I don't make it. + I'd prefer to have hints/answers written more algebraically without $\sum$ etc. (It helps me get better understanding what's going on under the hood) Sheafs and closed immersion How can a file be copied? Does $1.0000000000\cdots 1$ with an infinite number of $0$ in it exist? Cool Text Highlighting in LaTeX LaTeX has soul. ConTeXt, of course, , where you can put sweet hightligher under your text for free!    In the pictured example, you can see highlights that not only highlight, but that do it with cool edges that look so good, you can smell fumes! The fearless author says he'll show how that was done in another post; this one shows only how to lay down a straight, yellow box. But, it is possible to do word-wrapped highlighting with cool-shapped boxes within ConTeXt, presumably.  The trouble for me is that getting into the ConTeXt world is steep climb right now, given the state of documentation and the flux of changes, so I need to continue with LaTeX. But the real problem is that now I can't live without the Organic-Looking Highlights of Awesomeness in that picture!  As I said, Non-Organic-Looking Highlights of the Ordinary are easy with the soul package:  \hl{Some awesome text that word wraps fine.}   It just taunts me on the page with its straight lines. So, if I sacrifice word wrapping, I can use PGF/TiKz and create the following macro:  \newcommand\hl[1]{%     \tikz[baseline,%       decoration={random steps,amplitude=1pt,segment length=15pt},%       outer sep=-15pt, inner sep = 0pt%     ]%    \node[decorate,rectangle,fill=navcolor,anchor=text]{#1\xspace};% }%   Which creates something like this:    Now, my color is too dark and my randomness needs adjusting, but you see that a similar effect could be achieved.  My trouble is that I don't understand TeX enough to dig into the Soul package and add the TiKz/PGF goodness that it so sorely needs. So, I leave it to you guys. Anyone want to tackle this?   Or is it yet another piece of fruit, just a touch out of reach, that shall have to wait until ConTeXt settles down? Smoothness constraint of wave function Is there anything in the physics that enforces the wave function to be $C^2$? Are weak solutions to the Schroedinger equation physical? I am reading the beginning chapters of Griffiths and he doesn't mention anything. Storage order vs Result order What is the best, easiest, preferably cheapest way to make OS X write to NTFS-formatted drives in Mac OS X? How do I change text on the submission button in the node form? How do I get a list of all files (and directories) in a given directory in Python? Find the limit if it exists of $S_{n+1} = \frac{1}{2}(S_n +\frac{A}{S_n})$ Proof of when is $A=X^TX$ invertible? Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly.  UPDATE: Check  about the same issue. Why can ECC key sizes be smaller than RSA keys for similar security? The indexer into Dictionary throws an exception if the key is missing.  Is there an implementation of IDictionary that instead will return default(T)? I know about the TryGetValue() method, but that's impossible to use with LINQ. Would this efficiently do what I need?: myDict.FirstOrDefault(a =&gt; a.Key == someKeyKalue);  I don't think it will as I think it will iterate the keys instead of using a Hash lookup. At the moment I'm working with the . For this I read the following paper: .  But I have some mathematical problems with this formalism. I don't really see why this is a variation principle since it is opartor-valued.   The action principle is defined by: $\delta S  = G_1 -G_2$, where $S$ is the action operator $S = \int_{t_1}^{t_2} dt ~L$ and $G$ the generator operators of the transformations.  What does it mean that the action principle is operator-valued? For the classical action where $S$ is real we search for a stationary point but for operators? I also have a problem that $\delta S \neq 0$. What interpretation has this additional term $G_1 - G_2$? How do I say what is the current UTC in eastern zone Add the Same Modifier to Multiple Objects at Once?