mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-11-21 20:35:12 +00:00
commit
d7fb65e5c5
@ -578,8 +578,8 @@ class MyClass extends MySuperClass implements YourInterface {
|
|||||||
```java
|
```java
|
||||||
public class Queue<Item> implements Iterable<Item>
|
public class Queue<Item> implements Iterable<Item>
|
||||||
|
|
||||||
Queue() //create an emptyh queue
|
Queue() //create an empty queue
|
||||||
boolean isEmpthy() //return if the queue empthy
|
boolean isEmpty() //return if the queue empty
|
||||||
void enqueue(Item item) // insert an item onto queue
|
void enqueue(Item item) // insert an item onto queue
|
||||||
Item dequeue() //return and remove the item that was inserted least recently
|
Item dequeue() //return and remove the item that was inserted least recently
|
||||||
int size() //number of item on queue
|
int size() //number of item on queue
|
||||||
@ -591,7 +591,7 @@ class MyClass extends MySuperClass implements YourInterface {
|
|||||||
//import Iterator
|
//import Iterator
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class Queue<Item> implements Iterable <Item> {
|
public class Queue<Item> implements Iterable<Item> {
|
||||||
|
|
||||||
//FIFO queue
|
//FIFO queue
|
||||||
private Node first;
|
private Node first;
|
||||||
@ -627,9 +627,9 @@ public class Queue<Item> implements Iterable <Item> {
|
|||||||
* **SET DATA TYPE**
|
* **SET DATA TYPE**
|
||||||
|
|
||||||
```java
|
```java
|
||||||
public class SET<Key extends Comparable<Key>> implements Iterable<Key>
|
public class Set<Key extends Comparable<Key>> implements Iterable<Key>
|
||||||
SET() //create an empthy set
|
Set() //create an empty set
|
||||||
boolean isEmpthy() //return if the set is empthy
|
boolean isEmpty() //return if the set is empty
|
||||||
void add (Key key) //add key to the set
|
void add (Key key) //add key to the set
|
||||||
void remove(Key key) //remove key from set
|
void remove(Key key) //remove key from set
|
||||||
boolean contains(Key key) //return if the key is in the set
|
boolean contains(Key key) //return if the key is in the set
|
||||||
|
Loading…
Reference in New Issue
Block a user