I just saw that seems to be used (in roughly equal parts) for two entirely different things that share a name:

While <> in Java is not strictly speaking an operator, it is often described as such.

Do you have any suggestion?

  • so what do they call it in Java 7? – Lance Roberts Sep 26 '11 at 14:10
  • 13
    I thought this was gonna be a post about moderators. =) – Adam Lear Sep 26 '11 at 14:18
  • @LanceRoberts: the tutorial "simply" calls it "empty set of type parameters (<>)" and adds "This pair of angle brackets is informally called the diamond.". Unfortunately I can't find the Java Language Specification for Java 7 so I can't check if there is a technically correct term for it. – Joachim Sauer Sep 26 '11 at 14:20
  • 4
    Simple rule of thumb: If it is not an operator, don't tag it as operator. – Time Traveling Bobby Sep 26 '11 at 14:24
  • @PaddedCell: I tend to agree with you, but it seems that the term "diamond operator" is already deeply seated in the Java community. In unrelated news: I'm not sure that the Perl diamond operator is an operator. But I don't know enough about Perl to be sure. – Joachim Sauer Sep 26 '11 at 14:28
  • Had the same issue with [MVVM], which is used to describe a pattern used in both [WPF] and [KnockoutJS]. – user1228 Sep 26 '11 at 14:37

Just use the and the language tag with it will show which one is referred to.

Otherwise you'ld have to create the and , and that seems a little over the top for such a special use case.


I'd edit the tag excerpt to explain the ambiguity. Something like

The term "diamond operator" is ambiguous. In Perl, the diamond operator <> provides an easy way to read input from files specified on command line. In Java, the diamond operator <> allows you to invoke the constructor of a generic class with an empty set of type parameters as long as the compiler can infer the type arguments from the context.

The same is done on a few tags, like . If necessary, suggest along to include the relevant language tag.

  • Maybe a little shorter for the excerpt, with your paragraph in the main text. – Lance Roberts Sep 26 '11 at 17:28

Not the answer you're looking for? Browse other questions tagged .