File tree Expand file tree Collapse file tree
core-java/src/test/java/org/baeldung/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .baeldung .java .diamond ;
2+
3+ public class Car <T extends Engine > implements Vehicle <T > {
4+
5+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .java .diamond ;
2+
3+ import static org .junit .Assert .assertNotNull ;
4+
5+ import org .junit .Test ;
6+
7+ public class DiamondOperatorUnitTest {
8+ @ Test
9+ public void whenCreateCarUsingDiamondOperator_thenSuccess () {
10+ Car <Diesel > myCar = new Car <>();
11+ assertNotNull (myCar );
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .java .diamond ;
2+
3+ public class Diesel implements Engine {
4+
5+ @ Override
6+ public void start () {
7+ System .out .println ("Started Diesel..." );
8+ }
9+
10+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .java .diamond ;
2+
3+ public interface Engine {
4+
5+ void start ();
6+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .java .diamond ;
2+
3+ public interface Vehicle <T extends Engine > {
4+
5+ }
Original file line number Diff line number Diff line change 1+ package org .baeldung .java .rawtypes ;
2+
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+
6+ import org .junit .Test ;
7+
8+ public class RawTypesTest {
9+ @ Test
10+ public void shouldCreateListUsingRawTypes () {
11+ @ SuppressWarnings ("rawtypes" )
12+ List myList = new ArrayList ();
13+ myList .add (new Object ());
14+ myList .add ("2" );
15+ myList .add (new Integer (1 ));
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments