Here is my code:  public class MyClass&lt;A, B&gt; {     ArrayList&lt;A&gt; arrayA;     ArrayList&lt;B[]&gt; arrayB;      ...// other methods      public void put(A a, B b) {         //in case 'a' does not exist in arrayA, I want to create new array in arrayB (generic array)         B[] temp = new B[]();         //add some item here         arrayB.add(temp)     } }   This doesn't work and I don't know why. Initialization of new array B[] gives compile error. What's the way I could fix this? Or how could I go around this?
Due to the implementation of Java generics, you can't have code like this:   public class GenSet&lt;E&gt; {     private E a[];      public GenSet() {         a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation     } }   How can I implement this while maintaining type safety?  I saw a solution on the Java forums that goes like this:  import java.lang.reflect.Array;  class Stack&lt;T&gt; {     public Stack(Class&lt;T&gt; clazz, int capacity) {         array = (T[])Array.newInstance(clazz, capacity);     }      private final T[] array; }   But I really don't get what's going on.
Are employments in universities affiliated (or named) with a specific religion restricted to people with the same religion? I just saw an ad in mathjobs.org about an opening in a Catholic university, see . I am not christian. So I was wondering to be eligible for employment in a university or college affiliated with a specific religion, should the applicant  have the same religion, or other people from other religions (or even non-religious people) are eligible to apply as well? Inexact measurement and wavefunction collapse As is usually said, measurement of an observable $q$ leads to collapse of wavefunction to an eigenstate of the corresponding operator $\hat q$. That is, now the wavefunction in $q$ representation is $\psi(q)=\delta(q-q_0)$ where $q_0$ is result of measurement.  Now, in reality measurements are never exact, so the wavefunction should not have that sharp peak. Instead it should be broadened depending on precision of measurement. In this case, can we still introduce an operator, an eigenstate of which would the new wavefunction appear? Is it useful in any way? Or does the new wavefunction depend too much on the way it was measured so that each instrument would have its own operator? How would such opeartor look e.g. for a single-slit experiment? Long, blurry reflections in wet road How does an Intelligence penalty affect skill points when character-building/leveling-up? What canon evidence is there that Stormtroopers are/are not still clones? Reading this article about , my nerd-rage started flaring as they claimed that Stormtroopers were still Fett-Clones 20 years after the rise of the Empire.  As I started thinking about it, I realized that everything I had read saying that Modern-Day Stormtroopers not being clones was from the EU - C Level books or games.   One of the quotes often cited for backing the idea that the Stormtroopers are clones comes from Princess Leia:     Aren't you a little short for a Stormtrooper?   But through the movie, paying close attention, Stormtroopers are often shown to be slightly different heights. One even hits his head in the doorway while others walk through uninjured.                                  Is there any G Canon fully canon (non-Legends/Infinities) evidence to support the idea that Stormtroopers are, or are not still clones at the time of Episode IV? How to get the newest file in a directory in php I've just bought my first Mac, a Macbook pro(with an hdd), and I'm thinking in buying an ssd and replace the hdd. But the computer came with no dvd of the OS. I know that in the hdd there is a restore partition, but if I remove the hdd, how can I install the OS? Refused UK Visit visa for lack of sufficient funds - What more can I do? Now that I have Firefox 49 or higher, how do I watch Netflix? Can the definite article be omitted when referring to a person qualified by a noun? A proof that $1=2$. May I know why it’s false? Wikipedia entry on likelihood seems ambiguous Near Earth vs Newtonian gravitational potential Newton's Law of Universal Gravitation tells us that the potential energy of object in a gravitational field is $$U ~=~ -\frac{GMm}{r}.\tag{1}$$  The experimentally verified near-Earth gravitational potential is  $$U ~=~ mgh.\tag{2}$$  The near-Earth potential should be an approximation for the general potential energy when $r\approx r_{\text{Earth}}$, but the problem I'm having is that they scale differently with distance.  $(1)$ scales as $\frac 1r$.  So the greater the distance from the Earth, the less potential energy an object should have.  But $(2)$ scales proportionally to distance.  So the greater the distance from the Earth, the more potential energy an object should have.  How is this reconcilable? After the upgrade I can't figure out how the new shield system works. I have the option to discard the shield, and I notice I have a new potion in the inventory.  More importantly, I got attacked (and lost) twice in a short amount of time and don't have a shield. When do you now get shield? Let $ P(x)=x^8 - x^7 +x^2 -x +15 $, Descartes' Rule of Signs tells us that the polynomial has 4 positive real roots , but if we group the terms as $$ P(x)= x(x-1)(x^6+1) +15 $$ we find that $ P(x) $ does not have any positive roots.  Where did I err ? A commercial airport being any airport that has regular scheduled passenger flights.  The mathematics of  got me thinking: is the network of scheduled flights a connected graph?  That is, is there a pair (or triplet or even larger set) of airports such that they only have scheduled flights with each other?  Or can you get from any airport to any other?  Ignore vagaries like cargo and general aviation. I'm looking for two airports that I can shuttle between, but would have to drive (or sail) to get to one or the other of them. How to define global functions in PHP What do you call exaggerations like "I'm starving"? For example, when you are a little hungry and you say "I'm starving", or when you are so tired and you say "I'm dying". What do you call these type of expressions? Just exaggerations? I don't know how to explain this better. $\infty = -1 $ paradox I puzzled two high school Pre-calc math teachers today with a little proof (maybe not) I found a couple years ago that infinity is equal to -1:   Let x equal the geometric series: $1 + 2 + 4 + 8 + 16 \ldots$  $x = 1 + 2 + 4 + 8 + 16 \ldots$ Multiply each side by 2:  $2x = 2 + 4 + 8 + 16 + 32 \ldots$ Again from the equation in step 1, move the $1$ term to the left hand of the equation:  $x - 1 = 2 + 4 + 8 + 16 + 32 \ldots$ So the following appears to be true:  $2x = x - 1 \implies x = -1$   This is obviously illogical. The teachers told me the problem has to do with adding the two infinite geometric series, but they weren't positive. I'm currently in Pre-calc, so I have extremely little knowledge on calculus, but a little help with this paradox would be appreciated. Black artifacts when looking through many transparent objects?