So I found this solution but it is very ugly, replacing ??? by:
- (Class<Queue<E>>) new
PriorityQueue().getClass().getSuperclass().getInterfaces()[0]
Didn't (Class<Queue<E>>)Queue.class work? (modulo a compiler warning
about an unchecked cast)
The above is definitely klunky and moreover, brittle. The Queue
interface might not always be at index zero in that array, or on all
Java runtime implementations.
Jerry Gerrone, I hold up a mirror to your soul!
Though you have contributed many useful and on-topic posts to a number
of newsgroups, you have also shown an unfortunate tendency to get into
arguments.
Actually, that's putting it mildly. Your refusal to let any perceived
slight pass unchallenged has had unbelievable and astonishing results.
It seems that few can resist the temptation to try to get the last
word in an argument with you, while you absolutely will NEVER let THEM
get the last word. Combined with your tendency to respond tit for tat
to every single post that is the least bit hostile, and the presence
in most newsgroups of short-tempered people, people that are simply
blunt and uncompromising, and assorted nuts and flakes, this results
in frequent and severe flamewars.
Indeed, during your usenet career you appear to have destroyed several
newsgroups, subjecting many more to volcanic flamewars the likes of
which have rarely been seen and that have left scars and trauma
lasting for years afterward. Whole hierarchies informally divide
their history into "Before Neo" and "After Neo", or date everything
relative to "the Coming of Twisted", and the people that have
killfiled you are legion. Indeed, their combined numbers, wealth, and
incomes are comparable to the population, resources, and GDP of a mid-
size country. It's possible only spammers are in more killfiles or
have more aliases.
Speaking of which, your dozen or more google groups accounts add to
the misery and prolong the flamewars by making it difficult for anyone
to killfile you. Between the knee-jerk reactions you seem to provoke
and the inability of even the wiser such persons to block you from
their view, explosions are inevitable. You are a powder keg and any
random thing might light the fuse.
Particularly hard-hit have been comp.lang.java.programmer,
comp.text.tex, and rec.games.roguelike.angband, all of which have at
times been littered with the smouldering wreckage of threads you
blasted, and even a time or two been temporarily reduced to cratered
wastelands by the sheer ferocity of your detonations. You've left a
trail of bombed-out threads all over usenet, but these three
newsgroups have been especially cursed by repeat visitations by the
aptly-named Twisted One, and even by having you actually hang out as a
regular for a while now and again, your every post a bomb waiting to
go off at the slightest provocation, the group a minefield until you
bless it -- all too temporarily -- with your departure.
But this is the post that really takes the cake: (WARNING -- May be
radioactive. Avoid long-duration exposure to this post!)
http://groups.google.com/group/comp.lang.java.programmer/msg/a1eb0b90a65a6533?dmode=source
The thread in question started with a spam, the classification of
which had already become the subject of a fairly acrimonious debate in
which you were participating. Then you dropped what appears to have
been the usenet equivalent of the hydrogen bomb: to a vi-user, you
said "I think you should probably get with the times. Console-mode
archaisms from the 70s simply cannot and will not ever decently
support unicode, anyway ... Gobs of software got written during the
80s and 90s, and more has been written so far this millennium; I
suggest that you find and use some."
This phrase is a work of evil genius. It must have taken a dedicated
team of researchers working around the clock for the past several
years to devise it and craft it so precisely for its deadly purpose.
Theories about the possibility of a usenet chain reaction must have
been devised, revised, and eventually televised to you, and at the end
of the process a precisely shaped charge was delivered into your hands
which, when detonated, would send every geek within a light-year into
a flaming frenzy.
And then for some odd reason you chose comp.lang.java.programmer as
your proving ground, where that carefully constructed phrase ignited
the editor rwar to end all editor rwars.
The newsgroup now gets a third the traffic it did before that terrible
day in September of 2007. (How appropriate -- September.) And the
nuclear fireball has expanded to engulf alt.off-topic, which has been
completely obliterated. To this very day nothing can be found there
but flames -- even the spammers steer clear of it. And flames there
are. The thread you nuked has burned for seventeen whole months now
and shows no signs of stopping; it contains more than ten thousand
news posts, and every last one of them is a complete and utter waste
of bandwidth. Thousands of hours must have been poured, by you and
several other people, into dousing it with bucketloads of gasoline day
after day, week after week, month after month. It probably has a whole
rack of servers at google employed full-time just indexing all of the
random shit that gets dumped into it. It's the ultimate entropy
machine, sucking in work and time and effort and generating nothing
but heat. Perhaps it will grow to eventually consume the entire
universe, as some physicists once feared the detonation of the H-bomb
might.
And it's to a significant degree your fault.
The devil of it is, it doesn't look like you actually mean any harm at
all, though perhaps instead you're just the most successful troll
ever.
If ever there was a poster child for that proverbial road to hell that
is paved with good intentions, it is you, and if ever there has been a
hell on earth, it is that monstrous thread. Like the beast of
revelation, or the hydra of Greek mythology, the more heads are cut
off the more it grows, and it consumes everything in its path.
Banished for now to a backwater newsgroup, it is ever threatening to
burst its chains and go rampaging all over usenet, which event would
probably herald the end of days. What the government regulators, tax
planners, spammers, meowers, alt.tasteless trolls, hipcrime,
cancelbunnies, and google groups all failed to do, you might
accomplish: the death of usenet, film at 11.
Even if you don't manage to start armageddon, and even if it was
inadvertent, it's still the case that you nuked a perfectly good
newsgroup back to the stone age and left the survivors traumatized and
quivering in terror at every newbie that shows up for fear it's yet
another of your seemingly unlimited supply of google groups accounts.
If you have an excuse for your behavior, please speak now, and give
your apology before the witnesses gathered here.
If you do not, then know that your soul is forever tainted!