mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-06 15:17:00 +08:00
docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
This commit is contained in:
committed by
GitHub
parent
2487a27036
commit
954c45864b
40
ja/codes/java/chapter_stack_and_queue/queue.java
Normal file
40
ja/codes/java/chapter_stack_and_queue/queue.java
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* File: queue.java
|
||||
* Created Time: 2022-11-25
|
||||
* Author: krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
package chapter_stack_and_queue;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class queue {
|
||||
public static void main(String[] args) {
|
||||
/* キューを初期化 */
|
||||
Queue<Integer> queue = new LinkedList<>();
|
||||
|
||||
/* 要素をエンキュー */
|
||||
queue.offer(1);
|
||||
queue.offer(3);
|
||||
queue.offer(2);
|
||||
queue.offer(5);
|
||||
queue.offer(4);
|
||||
System.out.println("キュー queue = " + queue);
|
||||
|
||||
/* 先頭要素にアクセス */
|
||||
int peek = queue.peek();
|
||||
System.out.println("先頭要素 peek = " + peek);
|
||||
|
||||
/* 要素をデキュー */
|
||||
int pop = queue.poll();
|
||||
System.out.println("デキューした要素 = " + pop + "、デキュー後 " + queue);
|
||||
|
||||
/* キューの長さを取得 */
|
||||
int size = queue.size();
|
||||
System.out.println("キューの長さ size = " + size);
|
||||
|
||||
/* キューが空かどうかを判定 */
|
||||
boolean isEmpty = queue.isEmpty();
|
||||
System.out.println("キューが空か = " + isEmpty);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user