mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8302815: Use new Math.clamp method in core libraries
Reviewed-by: alanb
This commit is contained in:
parent
5e1d1b7940
commit
3f3a1f534b
11 changed files with 37 additions and 45 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1270,7 +1270,7 @@ public class Hashtable<K,V>
|
|||
float lf = fields.get("loadFactor", 0.75f);
|
||||
if (lf <= 0 || Float.isNaN(lf))
|
||||
throw new StreamCorruptedException("Illegal load factor: " + lf);
|
||||
lf = Math.min(Math.max(0.25f, lf), 4.0f);
|
||||
lf = Math.clamp(lf, 0.25f, 4.0f);
|
||||
|
||||
// Read the original length of the array and number of elements
|
||||
int origlength = s.readInt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue