peri hoki perihoki clarustologistics rimashaop.com fenomena gates of olympus buka peluang besar bagi duta76 cara dapat pola emas rahasia di duta7 wild west gold trik menang pgsoft mahjong ways 2 modal receh maxwin duta76 duta76 main pgsoft mahjong ways 2 di sela istirahat scatter hitam mahjong wins 3 spin pasti jepe duta76 pola petir tersembunyi gates of olympus perihoki pgsoft perkuat mahjong ways 2 di akun perihoki perihoki beri pola jitu mahjong wins 3 auto maxwin exclusive perihoki gates of olympus hadirkan fitur super scatter pgsoft mahjong ways perihoki punya irama scatter sendiri pola jitu scatter hitam mahjong wins 3 auto maxwin di perihoki akun baru langsung panen di gates of olympus di duta76 cara buat akun duta76 menjadi gacor main mahjong ways 2 pgsoft mahjong wins 3 duta76 viral karena tembus maxwin dalam 7 menit cuan 10rb scatter mahjong ways santai main mahjong wins gacor scatter emas 257jt mahjong wins pegawai menang mahjong awsbet teknik menang mahjong ways yang efektif
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 282
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent
Filename: Session/Session.php
Line Number: 294
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 304
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 314
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 315
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 316
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 317
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 375
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time
Filename: drivers/Session_files_driver.php
Line Number: 108
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_set_save_handler(): Cannot change save handler when headers already sent
Filename: Session/Session.php
Line Number: 110
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: session_start(): Cannot start session when headers already sent
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct
File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once
File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once
Java - Viết chương trình tìm khóa nhỏ nhất trong TreeMap mà lớn hơn hoặc bằng với 1 khóa được đưa ra.
TỔNG QUAN
CẤU TRÚC ĐIỀU KHIỂN
VÒNG LẶP
CHUỖI VÀ MẢNG
COLLECTIONS
THƯ VIỆN QUAN TRỌNG
HƯỚNG ĐỐI TƯỢNG
XỬ LÝ LUỒNG
EXCEPTION
LÀM VIỆC VỚI FILE
THAM KHẢO
CÁC CHỦ ĐỀ
BÀI MỚI NHẤT
Java - Viết chương trình tìm khóa nhỏ nhất trong TreeMap mà lớn hơn hoặc bằng với 1 khóa được đưa ra.
Viết chương trình nhập vào các phần tử có khóa kiểu số thực cho TreeMap
. Sau đó tìm khóa nhỏ nhất trong các phần tử đó mà có giá trị lớn hơn hoặc bằng với 1 khóa bất kỳ được đưa ra.
Bài giải
-------------------- ######## --------------------
Hướng dẫn: Để tìm khóa nhỏ nhất trong các phần tử đó mà có giá trị lớn hơn hoặc bằng với 1 khóa bất kỳ được đưa ra, Java cung cấp cho chúng ta phương thức ceilingKey()
. Phương thức này sẽ trả về khóa nhỏ nhất có giá trị lớn hơn hoặc bằng với 1 khóa bất kỳ được đưa ra, nếu không tìm thấy giá trị khóa cần tìm thì sẽ trả về null
.
Bài viết này được đăng tại freetuts.net , không được copy dưới mọi hình thức.
Cú pháp
ceilingKey(K key);
, trong đó key
là khóa được đưa ra.
Bài giải
pubic static void main(String[] args) {
TreeMap<Float, Double> treeMap = new TreeMap<>();
treeMap.put(1.5f, 5.1d);
treeMap.put(3.23f, 3.32d);
treeMap.put(1.16f, 6.11d);
treeMap.put(7f, 8d);
treeMap.put(7.25f, 0.4d);
// tìm khóa nhỏ nhất lớn hơn hoặc bằng 1.5f
System.out.println("Khóa cần tìm = " + treeMap.ceilingKey(1.5f));
// tìm khóa nhỏ nhất lớn hơn hoặc bằng 1.15f
System.out.println("Khóa cần tìm = " + treeMap.ceilingKey(1.15f));
// tìm khóa nhỏ nhất lớn hơn hoặc bằng 6.9f
System.out.println("Khóa cần tìm = " + treeMap.ceilingKey(6.9f));
// tìm khóa nhỏ nhất lớn hơn hoặc bằng 7.26f
// kết quả sẽ trả về null
System.out.println("Khóa cần tìm = " + treeMap.ceilingKey(7.26f));
}
Kết quả sau khi biên dịch chương trình:
Câu hỏi thường gặp liên quan:
Cùng chuyên mục: