📄 cola.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package examen;import java.util.*;/** * * @author ANGEL */public class cola { LinkedList l; boolean lectura; boolean escritura; int id; cola(boolean lectura, boolean escritura,int id){ l = new LinkedList(); this.lectura = lectura; this.escritura = escritura; this.id = id; } void meter(String dato){ if(!dato.equals("") ){ l.offer(dato); } } String sacar(){ String valor = "no hay dato"; try{ valor = (String)l.poll(); }catch(NoSuchElementException e){ valor = "no hay dato"; } return valor; } void recorrer(){ System.out.println("Recorrido Cola "+id +" "+l); } void invertir(){ if(lectura){ lectura = false; escritura = true; }else if(escritura){ escritura = false; lectura = true; } } String tipo(){ if(escritura) return "[escritor]"; else return "[lector]"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -