Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4ffb177a
提交
4ffb177a
authored
7 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
the New utility class is now largely redundant
now that Java7 has simplified generic construction syntax
上级
f07266ae
隐藏空白字符变更
内嵌
并排
正在显示
92 个修改的文件
包含
227 行增加
和
277 行删除
+227
-277
Bnf.java
h2/src/main/org/h2/bnf/Bnf.java
+1
-1
Sentence.java
h2/src/main/org/h2/bnf/Sentence.java
+3
-3
Parser.java
h2/src/main/org/h2/command/Parser.java
+3
-3
AlterTableAddConstraint.java
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
+2
-2
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+1
-1
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+1
-1
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+1
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+3
-3
Update.java
h2/src/main/org/h2/command/dml/Update.java
+1
-1
ConstraintCheck.java
h2/src/main/org/h2/constraint/ConstraintCheck.java
+1
-1
ConstraintReferential.java
h2/src/main/org/h2/constraint/ConstraintReferential.java
+1
-1
ConstraintUnique.java
h2/src/main/org/h2/constraint/ConstraintUnique.java
+1
-1
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+20
-20
Engine.java
h2/src/main/org/h2/engine/Engine.java
+1
-1
Mode.java
h2/src/main/org/h2/engine/Mode.java
+1
-1
RightOwner.java
h2/src/main/org/h2/engine/RightOwner.java
+2
-2
Session.java
h2/src/main/org/h2/engine/Session.java
+7
-7
UndoLog.java
h2/src/main/org/h2/engine/UndoLog.java
+1
-1
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+5
-4
ExpressionVisitor.java
h2/src/main/org/h2/expression/ExpressionVisitor.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+3
-3
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+2
-2
FullTextSettings.java
h2/src/main/org/h2/fulltext/FullTextSettings.java
+7
-5
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+3
-3
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+3
-3
JdbcCallableStatement.java
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
+1
-1
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+2
-2
JdbcStatementBackwardsCompat.java
h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java
+1
-1
DatabaseInfo.java
h2/src/main/org/h2/jmx/DatabaseInfo.java
+2
-1
DataUtils.java
h2/src/main/org/h2/mvstore/DataUtils.java
+3
-3
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+12
-12
Page.java
h2/src/main/org/h2/mvstore/Page.java
+1
-1
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+1
-1
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+4
-3
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+1
-1
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+1
-1
LocalResult.java
h2/src/main/org/h2/result/LocalResult.java
+2
-2
Schema.java
h2/src/main/org/h2/schema/Schema.java
+5
-5
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+3
-2
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+4
-3
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+2
-2
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+6
-6
WebSession.java
h2/src/main/org/h2/server/web/WebSession.java
+2
-2
LobStorageBackend.java
h2/src/main/org/h2/store/LobStorageBackend.java
+1
-1
PageLog.java
h2/src/main/org/h2/store/PageLog.java
+2
-2
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+4
-4
RecoverTester.java
h2/src/main/org/h2/store/RecoverTester.java
+1
-1
FilePath.java
h2/src/main/org/h2/store/fs/FilePath.java
+2
-2
FileUtils.java
h2/src/main/org/h2/store/fs/FileUtils.java
+2
-1
Plan.java
h2/src/main/org/h2/table/Plan.java
+1
-1
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+3
-3
Table.java
h2/src/main/org/h2/table/Table.java
+2
-2
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+2
-2
TableView.java
h2/src/main/org/h2/table/TableView.java
+1
-1
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+2
-2
Recover.java
h2/src/main/org/h2/tools/Recover.java
+4
-4
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+1
-1
New.java
h2/src/main/org/h2/util/New.java
+0
-58
SmallMap.java
h2/src/main/org/h2/util/SmallMap.java
+1
-1
SoftHashMap.java
h2/src/main/org/h2/util/SoftHashMap.java
+2
-1
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+3
-3
TempFileDeleter.java
h2/src/main/org/h2/util/TempFileDeleter.java
+3
-2
ThreadDeadlockDetector.java
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
+3
-3
Utils.java
h2/src/main/org/h2/util/Utils.java
+1
-1
ValueHashMap.java
h2/src/main/org/h2/util/ValueHashMap.java
+2
-2
DataType.java
h2/src/main/org/h2/value/DataType.java
+2
-2
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+1
-1
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+1
-1
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+2
-2
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+4
-4
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+1
-1
TestCacheLIRS.java
h2/src/test/org/h2/test/store/TestCacheLIRS.java
+1
-1
TestCacheLongKeyLIRS.java
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
+1
-1
TestStreamStore.java
h2/src/test/org/h2/test/store/TestStreamStore.java
+5
-5
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+1
-1
Command.java
h2/src/test/org/h2/test/synth/sql/Command.java
+1
-1
Player.java
h2/src/test/org/h2/test/trace/Player.java
+1
-1
TestJmx.java
h2/src/test/org/h2/test/unit/TestJmx.java
+2
-2
TestReopen.java
h2/src/test/org/h2/test/unit/TestReopen.java
+1
-1
TestServlet.java
h2/src/test/org/h2/test/unit/TestServlet.java
+1
-1
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+3
-3
ProxyCodeGenerator.java
h2/src/test/org/h2/test/utils/ProxyCodeGenerator.java
+1
-1
PrepareTranslation.java
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
+1
-1
FileContentHash.java
h2/src/tools/org/h2/dev/util/FileContentHash.java
+1
-1
Db.java
h2/src/tools/org/h2/jaqu/Db.java
+2
-1
Query.java
h2/src/tools/org/h2/jaqu/Query.java
+1
-1
TableDefinition.java
h2/src/tools/org/h2/jaqu/TableDefinition.java
+2
-2
TableInspector.java
h2/src/tools/org/h2/jaqu/TableInspector.java
+6
-4
JavaParser.java
h2/src/tools/org/h2/java/JavaParser.java
+10
-15
没有找到文件。
h2/src/main/org/h2/bnf/Bnf.java
浏览文件 @
4ffb177a
...
...
@@ -31,7 +31,7 @@ public class Bnf {
* The rule map. The key is lowercase, and all spaces
* are replaces with underscore.
*/
private
final
HashMap
<
String
,
RuleHead
>
ruleMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
RuleHead
>
ruleMap
=
new
HashMap
<>
();
private
String
syntax
;
private
String
currentToken
;
private
String
[]
tokens
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/bnf/Sentence.java
浏览文件 @
4ffb177a
...
...
@@ -43,7 +43,7 @@ public class Sentence {
/**
* The map of next tokens in the form type#tokenName token.
*/
private
final
HashMap
<
String
,
String
>
next
=
New
.
hashMap
();
private
final
HashMap
<
String
,
String
>
next
=
new
HashMap
<>
();
/**
* The complete query string.
...
...
@@ -99,7 +99,7 @@ public class Sentence {
*/
public
void
addAlias
(
String
alias
,
DbTableOrView
table
)
{
if
(
aliases
==
null
)
{
aliases
=
New
.
hashMap
();
aliases
=
new
HashMap
<>
();
}
aliases
.
put
(
alias
,
table
);
}
...
...
@@ -112,7 +112,7 @@ public class Sentence {
public
void
addTable
(
DbTableOrView
table
)
{
lastTable
=
table
;
if
(
tables
==
null
)
{
tables
=
New
.
hashSet
();
tables
=
new
HashSet
<>
();
}
tables
.
add
(
table
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Parser.java
浏览文件 @
4ffb177a
...
...
@@ -925,7 +925,7 @@ public class Parser {
private
Column
[]
parseColumnList
(
Table
table
)
{
ArrayList
<
Column
>
columns
=
New
.
arrayList
();
HashSet
<
Column
>
set
=
New
.
hashSet
();
HashSet
<
Column
>
set
=
new
HashSet
<>
();
if
(!
readIf
(
")"
))
{
do
{
Column
column
=
parseColumn
(
table
);
...
...
@@ -1357,7 +1357,7 @@ public class Parser {
if
(
isSelect
())
{
Query
query
=
parseSelectUnion
();
read
(
")"
);
query
.
setParameterList
(
New
.
arrayList
(
parameters
));
query
.
setParameterList
(
new
ArrayList
<>
(
parameters
));
query
.
init
();
Session
s
;
if
(
createView
!=
null
)
{
...
...
@@ -5902,7 +5902,7 @@ public class Parser {
}
}
if
(
readIf
(
"SCHEMA"
))
{
HashSet
<
String
>
schemaNames
=
New
.
hashSet
();
HashSet
<
String
>
schemaNames
=
new
HashSet
<>
();
do
{
schemaNames
.
add
(
readUniqueIdentifier
());
}
while
(
readIf
(
","
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
浏览文件 @
4ffb177a
...
...
@@ -338,11 +338,11 @@ public class AlterTableAddConstraint extends SchemaCommand {
return
false
;
}
Column
[]
indexCols
=
idx
.
getColumns
();
HashSet
<
Column
>
indexColsSet
=
New
.
hashSet
();
HashSet
<
Column
>
indexColsSet
=
new
HashSet
<>
();
for
(
Column
c
:
indexCols
)
{
indexColsSet
.
add
(
c
);
}
HashSet
<
Column
>
colsSet
=
New
.
hashSet
();
HashSet
<
Column
>
colsSet
=
new
HashSet
<>
();
for
(
IndexColumn
c
:
cols
)
{
colsSet
.
add
(
c
.
column
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
4ffb177a
...
...
@@ -215,7 +215,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
if
(
defaultExpression
==
null
)
{
return
;
}
HashSet
<
DbObject
>
dependencies
=
New
.
hashSet
();
HashSet
<
DbObject
>
dependencies
=
new
HashSet
<>
();
ExpressionVisitor
visitor
=
ExpressionVisitor
.
getDependenciesVisitor
(
dependencies
);
defaultExpression
.
isEverything
(
visitor
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
4ffb177a
...
...
@@ -195,7 +195,7 @@ public class CreateTable extends SchemaCommand {
session
.
setUndoLogEnabled
(
old
);
}
}
HashSet
<
DbObject
>
set
=
New
.
hashSet
();
HashSet
<
DbObject
>
set
=
new
HashSet
<>
();
set
.
clear
();
table
.
addDependencies
(
set
);
for
(
DbObject
obj
:
set
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
4ffb177a
...
...
@@ -90,7 +90,7 @@ public class Insert extends Prepared implements ResultTarget {
*/
public
void
addAssignmentForDuplicate
(
Column
column
,
Expression
expression
)
{
if
(
duplicateKeyAssignmentMap
==
null
)
{
duplicateKeyAssignmentMap
=
New
.
hashMap
();
duplicateKeyAssignmentMap
=
new
HashMap
<>
();
}
if
(
duplicateKeyAssignmentMap
.
containsKey
(
column
))
{
throw
DbException
.
get
(
ErrorCode
.
DUPLICATE_COLUMN_NAME_1
,
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
4ffb177a
...
...
@@ -965,7 +965,7 @@ public class Select extends Query {
@Override
public
HashSet
<
Table
>
getTables
()
{
HashSet
<
Table
>
set
=
New
.
hashSet
();
HashSet
<
Table
>
set
=
new
HashSet
<>
();
for
(
TableFilter
filter
:
filters
)
{
set
.
add
(
filter
.
getTable
());
}
...
...
@@ -1497,11 +1497,11 @@ public class Select extends Query {
Value
[]
row
=
null
;
if
(
previousKeyValues
==
null
)
{
previousKeyValues
=
keyValues
;
currentGroup
=
New
.
hashMap
();
currentGroup
=
new
HashMap
<>
();
}
else
if
(!
Arrays
.
equals
(
previousKeyValues
,
keyValues
))
{
row
=
createGroupSortedRow
(
previousKeyValues
,
columnCount
);
previousKeyValues
=
keyValues
;
currentGroup
=
New
.
hashMap
();
currentGroup
=
new
HashMap
<>
();
}
currentGroupRowId
++;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
4ffb177a
...
...
@@ -48,7 +48,7 @@ public class Update extends Prepared {
private
Expression
limitExpr
;
private
final
ArrayList
<
Column
>
columns
=
New
.
arrayList
();
private
final
HashMap
<
Column
,
Expression
>
expressionMap
=
New
.
hashMap
();
private
final
HashMap
<
Column
,
Expression
>
expressionMap
=
new
HashMap
<>
();
public
Update
(
Session
session
)
{
super
(
session
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintCheck.java
浏览文件 @
4ffb177a
...
...
@@ -119,7 +119,7 @@ public class ConstraintCheck extends Constraint {
@Override
public
HashSet
<
Column
>
getReferencedColumns
(
Table
table
)
{
HashSet
<
Column
>
columns
=
New
.
hashSet
();
HashSet
<
Column
>
columns
=
new
HashSet
<>
();
expr
.
isEverything
(
ExpressionVisitor
.
getColumnsVisitor
(
columns
));
for
(
Iterator
<
Column
>
it
=
columns
.
iterator
();
it
.
hasNext
();)
{
if
(
it
.
next
().
getTable
()
!=
table
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintReferential.java
浏览文件 @
4ffb177a
...
...
@@ -225,7 +225,7 @@ public class ConstraintReferential extends Constraint {
@Override
public
HashSet
<
Column
>
getReferencedColumns
(
Table
table
)
{
HashSet
<
Column
>
result
=
New
.
hashSet
();
HashSet
<
Column
>
result
=
new
HashSet
<>
();
if
(
table
==
this
.
table
)
{
for
(
IndexColumn
c
:
columns
)
{
result
.
add
(
c
.
column
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintUnique.java
浏览文件 @
4ffb177a
...
...
@@ -134,7 +134,7 @@ public class ConstraintUnique extends Constraint {
@Override
public
HashSet
<
Column
>
getReferencedColumns
(
Table
table
)
{
HashSet
<
Column
>
result
=
New
.
hashSet
();
HashSet
<
Column
>
result
=
new
HashSet
<>
();
for
(
IndexColumn
c
:
columns
)
{
result
.
add
(
c
.
column
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
4ffb177a
...
...
@@ -639,7 +639,7 @@ public class ConnectionInfo implements Cloneable {
public
DbSettings
getDbSettings
()
{
DbSettings
defaultSettings
=
DbSettings
.
getDefaultSettings
();
HashMap
<
String
,
String
>
s
=
New
.
hashMap
();
HashMap
<
String
,
String
>
s
=
new
HashMap
<>
();
for
(
Object
k
:
prop
.
keySet
())
{
String
key
=
k
.
toString
();
if
(!
isKnownSetting
(
key
)
&&
defaultSettings
.
containsKey
(
key
))
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
4ffb177a
...
...
@@ -109,15 +109,15 @@ public class Database implements DataHandler {
private
final
byte
[]
filePasswordHash
;
private
final
byte
[]
fileEncryptionKey
;
private
final
HashMap
<
String
,
Role
>
roles
=
New
.
hashMap
();
private
final
HashMap
<
String
,
User
>
users
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Setting
>
settings
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Schema
>
schemas
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Right
>
rights
=
New
.
hashMap
();
private
final
HashMap
<
String
,
UserDataType
>
userDataTypes
=
New
.
hashMap
();
private
final
HashMap
<
String
,
UserAggregate
>
aggregates
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Comment
>
comments
=
New
.
hashMap
();
private
final
HashMap
<
String
,
TableEngine
>
tableEngines
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Role
>
roles
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
User
>
users
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
Setting
>
settings
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
Schema
>
schemas
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
Right
>
rights
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
UserDataType
>
userDataTypes
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
UserAggregate
>
aggregates
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
Comment
>
comments
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
TableEngine
>
tableEngines
=
new
HashMap
<>
();
private
final
Set
<
Session
>
userSessions
=
Collections
.
synchronizedSet
(
new
HashSet
<
Session
>());
...
...
@@ -1508,11 +1508,11 @@ public class Database implements DataHandler {
}
public
ArrayList
<
UserAggregate
>
getAllAggregates
()
{
return
New
.
arrayList
(
aggregates
.
values
());
return
new
ArrayList
<>
(
aggregates
.
values
());
}
public
ArrayList
<
Comment
>
getAllComments
()
{
return
New
.
arrayList
(
comments
.
values
());
return
new
ArrayList
<>
(
comments
.
values
());
}
public
int
getAllowLiterals
()
{
...
...
@@ -1523,11 +1523,11 @@ public class Database implements DataHandler {
}
public
ArrayList
<
Right
>
getAllRights
()
{
return
New
.
arrayList
(
rights
.
values
());
return
new
ArrayList
<>
(
rights
.
values
());
}
public
ArrayList
<
Role
>
getAllRoles
()
{
return
New
.
arrayList
(
roles
.
values
());
return
new
ArrayList
<>
(
roles
.
values
());
}
/**
...
...
@@ -1612,19 +1612,19 @@ public class Database implements DataHandler {
public
ArrayList
<
Schema
>
getAllSchemas
()
{
initMetaTables
();
return
New
.
arrayList
(
schemas
.
values
());
return
new
ArrayList
<>
(
schemas
.
values
());
}
public
ArrayList
<
Setting
>
getAllSettings
()
{
return
New
.
arrayList
(
settings
.
values
());
return
new
ArrayList
<>
(
settings
.
values
());
}
public
ArrayList
<
UserDataType
>
getAllUserDataTypes
()
{
return
New
.
arrayList
(
userDataTypes
.
values
());
return
new
ArrayList
<>
(
userDataTypes
.
values
());
}
public
ArrayList
<
User
>
getAllUsers
()
{
return
New
.
arrayList
(
users
.
values
());
return
new
ArrayList
<>
(
users
.
values
());
}
public
String
getCacheType
()
{
...
...
@@ -1668,7 +1668,7 @@ public class Database implements DataHandler {
// need to synchronized on userSession, otherwise the list
// may contain null elements
synchronized
(
userSessions
)
{
list
=
New
.
arrayList
(
userSessions
);
list
=
new
ArrayList
<>
(
userSessions
);
}
// copy, to ensure the reference is stable
Session
sys
=
systemSession
;
...
...
@@ -1850,7 +1850,7 @@ public class Database implements DataHandler {
return
null
;
default
:
}
HashSet
<
DbObject
>
set
=
New
.
hashSet
();
HashSet
<
DbObject
>
set
=
new
HashSet
<>
();
for
(
Table
t
:
getAllTablesAndViews
(
false
))
{
if
(
except
==
t
)
{
continue
;
...
...
@@ -2500,7 +2500,7 @@ public class Database implements DataHandler {
public
TableLinkConnection
getLinkConnection
(
String
driver
,
String
url
,
String
user
,
String
password
)
{
if
(
linkConnections
==
null
)
{
linkConnections
=
New
.
hashMap
();
linkConnections
=
new
HashMap
<>
();
}
return
TableLinkConnection
.
open
(
linkConnections
,
driver
,
url
,
user
,
password
,
dbSettings
.
shareLinkedConnections
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
4ffb177a
...
...
@@ -28,7 +28,7 @@ import org.h2.util.Utils;
public
class
Engine
implements
SessionFactory
{
private
static
final
Engine
INSTANCE
=
new
Engine
();
private
static
final
HashMap
<
String
,
Database
>
DATABASES
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
Database
>
DATABASES
=
new
HashMap
<>
();
private
volatile
long
wrongPasswordDelay
=
SysProperties
.
DELAY_WRONG_PASSWORD_MIN
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
4ffb177a
...
...
@@ -22,7 +22,7 @@ public class Mode {
REGULAR
,
DB2
,
Derby
,
MSSQLServer
,
HSQLDB
,
MySQL
,
Oracle
,
PostgreSQL
,
Ignite
,
}
private
static
final
HashMap
<
String
,
Mode
>
MODES
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
Mode
>
MODES
=
new
HashMap
<>
();
// Modes are also documented in the features section
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/RightOwner.java
浏览文件 @
4ffb177a
...
...
@@ -100,7 +100,7 @@ public abstract class RightOwner extends DbObjectBase {
*/
public
void
grantRight
(
DbObject
object
,
Right
right
)
{
if
(
grantedRights
==
null
)
{
grantedRights
=
New
.
hashMap
();
grantedRights
=
new
HashMap
<>
();
}
grantedRights
.
put
(
object
,
right
);
}
...
...
@@ -128,7 +128,7 @@ public abstract class RightOwner extends DbObjectBase {
*/
public
void
grantRole
(
Role
role
,
Right
right
)
{
if
(
grantedRoles
==
null
)
{
grantedRoles
=
New
.
hashMap
();
grantedRoles
=
new
HashMap
<>
();
}
grantedRoles
.
put
(
role
,
right
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
4ffb177a
...
...
@@ -374,7 +374,7 @@ public class Session extends SessionWithState {
if
(
localTempTables
==
null
)
{
return
New
.
arrayList
();
}
return
New
.
arrayList
(
localTempTables
.
values
());
return
new
ArrayList
<>
(
localTempTables
.
values
());
}
/**
...
...
@@ -427,7 +427,7 @@ public class Session extends SessionWithState {
public
HashMap
<
String
,
Index
>
getLocalTempTableIndexes
()
{
if
(
localTempTableIndexes
==
null
)
{
return
New
.
hashMap
();
return
new
HashMap
<>
();
}
return
localTempTableIndexes
;
}
...
...
@@ -485,7 +485,7 @@ public class Session extends SessionWithState {
*/
public
HashMap
<
String
,
Constraint
>
getLocalTempTableConstraints
()
{
if
(
localTempTableConstraints
==
null
)
{
return
New
.
hashMap
();
return
new
HashMap
<>
();
}
return
localTempTableConstraints
;
}
...
...
@@ -1338,7 +1338,7 @@ public class Session extends SessionWithState {
DbException
.
throwInternalError
(
v
.
toString
());
}
if
(
removeLobMap
==
null
)
{
removeLobMap
=
New
.
hashMap
();
removeLobMap
=
new
HashMap
<>
();
}
removeLobMap
.
put
(
v
.
toString
(),
v
);
}
...
...
@@ -1511,7 +1511,7 @@ public class Session extends SessionWithState {
// not grow too large for a single query (we drop the whole cache in
// the end of prepareLocal)
if
(
subQueryIndexCache
==
null
)
{
subQueryIndexCache
=
New
.
hashMap
();
subQueryIndexCache
=
new
HashMap
<>
();
}
return
subQueryIndexCache
;
}
...
...
@@ -1534,7 +1534,7 @@ public class Session extends SessionWithState {
return
;
}
if
(
temporaryResults
==
null
)
{
temporaryResults
=
New
.
hashSet
();
temporaryResults
=
new
HashSet
<>
();
}
if
(
temporaryResults
.
size
()
<
100
)
{
// reference at most 100 result sets to avoid memory problems
...
...
@@ -1740,7 +1740,7 @@ public class Session extends SessionWithState {
*/
public
void
markTableForAnalyze
(
Table
table
)
{
if
(
tablesToAnalyze
==
null
)
{
tablesToAnalyze
=
New
.
hashSet
();
tablesToAnalyze
=
new
HashSet
<>
();
}
tablesToAnalyze
.
add
(
table
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/UndoLog.java
浏览文件 @
4ffb177a
...
...
@@ -223,7 +223,7 @@ public class UndoLog {
int
getTableId
(
Table
table
)
{
int
id
=
table
.
getId
();
if
(
tables
==
null
)
{
tables
=
New
.
hashMap
();
tables
=
new
HashMap
<>
();
}
// need to overwrite the old entry, because the old object
// might be deleted in the meantime
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
4ffb177a
...
...
@@ -5,6 +5,7 @@
*/
package
org
.
h2
.
expression
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
...
...
@@ -565,16 +566,16 @@ public class Comparison extends Condition {
Database
db
=
session
.
getDatabase
();
if
(
rc
&&
r2c
&&
l
.
equals
(
l2
))
{
return
new
ConditionIn
(
db
,
left
,
New
.
arrayList
(
Arrays
.
asList
(
right
,
other
.
right
)));
new
ArrayList
<>
(
Arrays
.
asList
(
right
,
other
.
right
)));
}
else
if
(
rc
&&
l2c
&&
l
.
equals
(
r2
))
{
return
new
ConditionIn
(
db
,
left
,
New
.
arrayList
(
Arrays
.
asList
(
right
,
other
.
left
)));
new
ArrayList
<>
(
Arrays
.
asList
(
right
,
other
.
left
)));
}
else
if
(
lc
&&
r2c
&&
r
.
equals
(
l2
))
{
return
new
ConditionIn
(
db
,
right
,
New
.
arrayList
(
Arrays
.
asList
(
left
,
other
.
right
)));
new
ArrayList
<>
(
Arrays
.
asList
(
left
,
other
.
right
)));
}
else
if
(
lc
&&
l2c
&&
r
.
equals
(
r2
))
{
return
new
ConditionIn
(
db
,
right
,
New
.
arrayList
(
Arrays
.
asList
(
left
,
other
.
left
)));
new
ArrayList
<>
(
Arrays
.
asList
(
left
,
other
.
left
)));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ExpressionVisitor.java
浏览文件 @
4ffb177a
...
...
@@ -294,7 +294,7 @@ public class ExpressionVisitor {
* @return the set of columns
*/
public
static
HashSet
<
Column
>
allColumnsForTableFilters
(
TableFilter
[]
filters
)
{
HashSet
<
Column
>
allColumnsSet
=
New
.
hashSet
();
HashSet
<
Column
>
allColumnsSet
=
new
HashSet
<>
();
for
(
int
i
=
0
;
i
<
filters
.
length
;
i
++)
{
if
(
filters
[
i
].
getSelect
()
!=
null
)
{
filters
[
i
].
getSelect
().
isEverything
(
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
4ffb177a
...
...
@@ -143,8 +143,8 @@ public class Function extends Expression implements FunctionCall {
private
static
final
int
VAR_ARGS
=
-
1
;
private
static
final
long
PRECISION_UNKNOWN
=
-
1
;
private
static
final
HashMap
<
String
,
FunctionInfo
>
FUNCTIONS
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
Integer
>
DATE_PART
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
FunctionInfo
>
FUNCTIONS
=
new
HashMap
<>
();
private
static
final
HashMap
<
String
,
Integer
>
DATE_PART
=
new
HashMap
<>
();
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
protected
Expression
[]
args
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
4ffb177a
...
...
@@ -602,7 +602,7 @@ public class FullText {
if
(!
setting
.
isInitialized
())
{
init
(
conn
);
}
Set
<
String
>
words
=
New
.
hashSet
();
Set
<
String
>
words
=
new
HashSet
<>
();
addWords
(
setting
,
words
,
text
);
Set
<
Integer
>
rIds
=
null
,
lastRowIds
;
...
...
@@ -610,7 +610,7 @@ public class FullText {
SELECT_MAP_BY_WORD_ID
);
for
(
String
word
:
words
)
{
lastRowIds
=
rIds
;
rIds
=
New
.
hashSet
();
rIds
=
new
HashSet
<>
();
Integer
wId
=
setting
.
getWordId
(
word
);
if
(
wId
==
null
)
{
continue
;
...
...
@@ -1083,7 +1083,7 @@ public class FullText {
}
private
int
[]
getWordIds
(
Connection
conn
,
Object
[]
row
)
throws
SQLException
{
HashSet
<
String
>
words
=
New
.
hashSet
();
HashSet
<
String
>
words
=
new
HashSet
<>
();
for
(
int
idx
:
index
.
indexColumns
)
{
int
type
=
columnTypes
[
idx
];
Object
data
=
row
[
idx
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
4ffb177a
...
...
@@ -59,7 +59,7 @@ public class FullTextLucene extends FullText {
protected
static
final
boolean
STORE_DOCUMENT_TEXT_IN_INDEX
=
Utils
.
getProperty
(
"h2.storeDocumentTextInIndex"
,
false
);
private
static
final
HashMap
<
String
,
IndexAccess
>
INDEX_ACCESS
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
IndexAccess
>
INDEX_ACCESS
=
new
HashMap
<>
();
private
static
final
String
TRIGGER_PREFIX
=
"FTL_"
;
private
static
final
String
SCHEMA
=
"FTL"
;
private
static
final
String
LUCENE_FIELD_DATA
=
"_DATA"
;
...
...
@@ -685,7 +685,7 @@ public class FullTextLucene extends FullText {
/**
* Map of usage counters for outstanding searchers.
*/
private
final
Map
<
IndexSearcher
,
Integer
>
counters
=
New
.
hashMap
();
private
final
Map
<
IndexSearcher
,
Integer
>
counters
=
new
HashMap
<>
();
/**
* Usage counter for current searcher.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextSettings.java
浏览文件 @
4ffb177a
...
...
@@ -11,9 +11,10 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
org.h2.util.New
;
import
org.h2.util.SoftHashMap
;
/**
...
...
@@ -24,7 +25,7 @@ final class FullTextSettings {
/**
* The settings of open indexes.
*/
private
static
final
Map
<
String
,
FullTextSettings
>
SETTINGS
=
New
.
hashMap
();
private
static
final
Map
<
String
,
FullTextSettings
>
SETTINGS
=
new
HashMap
<>
();
/**
* Whether this instance has been initialized.
...
...
@@ -34,17 +35,18 @@ final class FullTextSettings {
/**
* The set of words not to index (stop words).
*/
private
final
Set
<
String
>
ignoreList
=
New
.
hashSet
();
private
final
Set
<
String
>
ignoreList
=
new
HashSet
<>
();
/**
* The set of words / terms.
*/
private
final
Map
<
String
,
Integer
>
words
=
New
.
hashMap
();
private
final
Map
<
String
,
Integer
>
words
=
new
HashMap
<>
();
/**
* The set of indexes in this database.
*/
private
final
Map
<
Integer
,
IndexInfo
>
indexes
=
Collections
.
synchronizedMap
(
New
.<
Integer
,
IndexInfo
>
hashMap
());
private
final
Map
<
Integer
,
IndexInfo
>
indexes
=
Collections
.
synchronizedMap
(
new
HashMap
<
Integer
,
IndexInfo
>());
/**
* The prepared statement cache.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
4ffb177a
...
...
@@ -64,7 +64,7 @@ public class PageDataIndex extends PageIndex {
// trace = database.getTrace(Trace.PAGE_STORE + "_di");
// trace.setLevel(TraceSystem.DEBUG);
if
(
multiVersion
)
{
sessionRowCount
=
New
.
hashMap
();
sessionRowCount
=
new
HashMap
<>
();
isMultiVersion
=
true
;
}
else
{
sessionRowCount
=
null
;
...
...
@@ -193,7 +193,7 @@ public class PageDataIndex extends PageIndex {
row
.
setDeleted
(
false
);
if
(
multiVersion
)
{
if
(
delta
==
null
)
{
delta
=
New
.
hashSet
();
delta
=
new
HashSet
<>
();
}
boolean
wasDeleted
=
delta
.
remove
(
row
);
if
(!
wasDeleted
)
{
...
...
@@ -352,7 +352,7 @@ public class PageDataIndex extends PageIndex {
// if storage is null, the delete flag is not yet set
row
.
setDeleted
(
true
);
if
(
delta
==
null
)
{
delta
=
New
.
hashSet
();
delta
=
new
HashSet
<>
();
}
boolean
wasAdded
=
delta
.
remove
(
row
);
if
(!
wasAdded
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
4ffb177a
...
...
@@ -44,7 +44,7 @@ public class ScanIndex extends BaseIndex {
IndexType
indexType
)
{
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
if
(
database
.
isMultiVersion
())
{
sessionRowCount
=
New
.
hashMap
();
sessionRowCount
=
new
HashMap
<>
();
}
else
{
sessionRowCount
=
null
;
}
...
...
@@ -103,7 +103,7 @@ public class ScanIndex extends BaseIndex {
row
.
setDeleted
(
false
);
if
(
database
.
isMultiVersion
())
{
if
(
delta
==
null
)
{
delta
=
New
.
hashSet
();
delta
=
new
HashSet
<>
();
}
boolean
wasDeleted
=
delta
.
remove
(
row
);
if
(!
wasDeleted
)
{
...
...
@@ -156,7 +156,7 @@ public class ScanIndex extends BaseIndex {
// if storage is null, the delete flag is not yet set
row
.
setDeleted
(
true
);
if
(
delta
==
null
)
{
delta
=
New
.
hashSet
();
delta
=
new
HashSet
<>
();
}
boolean
wasAdded
=
delta
.
remove
(
row
);
if
(!
wasAdded
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
浏览文件 @
4ffb177a
...
...
@@ -1668,7 +1668,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements
if
(
namedParameters
==
null
)
{
ResultSetMetaData
meta
=
getCheckedMetaData
();
int
columnCount
=
meta
.
getColumnCount
();
HashMap
<
String
,
Integer
>
map
=
New
.
hashMap
(
columnCount
);
HashMap
<
String
,
Integer
>
map
=
new
HashMap
<>
(
columnCount
);
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
map
.
put
(
meta
.
getColumnLabel
(
i
),
i
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
4ffb177a
...
...
@@ -3125,7 +3125,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
if
(
columnCount
>=
3
)
{
// use a hash table if more than 2 columns
if
(
columnLabelMap
==
null
)
{
HashMap
<
String
,
Integer
>
map
=
New
.
hashMap
(
columnCount
);
HashMap
<
String
,
Integer
>
map
=
new
HashMap
<>
(
columnCount
);
// column labels have higher priority
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
String
c
=
StringUtils
.
toUpperEnglish
(
result
.
getAlias
(
i
));
...
...
@@ -3852,7 +3852,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
}
}
if
(
patchedRows
==
null
)
{
patchedRows
=
New
.
hashMap
();
patchedRows
=
new
HashMap
<>
();
}
Integer
rowId
=
result
.
getRowId
();
if
(!
changed
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java
浏览文件 @
4ffb177a
...
...
@@ -30,7 +30,7 @@ public interface JdbcStatementBackwardsCompat {
/**
* Gets the maximum number of rows for a ResultSet.
*
* @param max
Rows
the number of rows where 0 means no limit
* @param max the number of rows where 0 means no limit
* @throws SQLException if this object is closed
*/
void
setLargeMaxRows
(
long
max
)
throws
SQLException
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jmx/DatabaseInfo.java
浏览文件 @
4ffb177a
...
...
@@ -8,6 +8,7 @@ package org.h2.jmx;
import
java.lang.management.ManagementFactory
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.Hashtable
;
import
java.util.Map
;
import
java.util.TreeMap
;
...
...
@@ -31,7 +32,7 @@ import org.h2.util.New;
*/
public
class
DatabaseInfo
implements
DatabaseInfoMBean
{
private
static
final
Map
<
String
,
ObjectName
>
MBEANS
=
New
.
hashMap
();
private
static
final
Map
<
String
,
ObjectName
>
MBEANS
=
new
HashMap
<>
();
/** Database. */
private
final
Database
database
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/DataUtils.java
浏览文件 @
4ffb177a
...
...
@@ -569,7 +569,7 @@ public final class DataUtils {
*/
public
static
StringBuilder
appendMap
(
StringBuilder
buff
,
HashMap
<
String
,
?>
map
)
{
ArrayList
<
String
>
list
=
New
.
arrayList
(
map
.
keySet
());
ArrayList
<
String
>
list
=
new
ArrayList
<>
(
map
.
keySet
());
Collections
.
sort
(
list
);
for
(
String
k
:
list
)
{
appendMap
(
buff
,
k
,
map
.
get
(
k
));
...
...
@@ -656,7 +656,7 @@ public final class DataUtils {
* @throws IllegalStateException if parsing failed
*/
public
static
HashMap
<
String
,
String
>
parseMap
(
String
s
)
{
HashMap
<
String
,
String
>
map
=
New
.
hashMap
();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>
();
StringBuilder
buff
=
new
StringBuilder
();
for
(
int
i
=
0
,
size
=
s
.
length
();
i
<
size
;)
{
int
startKey
=
i
;
...
...
@@ -689,7 +689,7 @@ public final class DataUtils {
end
--;
}
String
s
=
new
String
(
bytes
,
start
,
end
-
start
,
StandardCharsets
.
ISO_8859_1
);
HashMap
<
String
,
String
>
map
=
New
.
hashMap
();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>
();
StringBuilder
buff
=
new
StringBuilder
();
for
(
int
i
=
0
,
size
=
s
.
length
();
i
<
size
;)
{
int
startKey
=
i
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
4ffb177a
...
...
@@ -1113,7 +1113,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
MVMap
<
K
,
V
>
openReadOnly
()
{
MVMap
<
K
,
V
>
m
=
new
MVMap
<>(
keyType
,
valueType
);
m
.
readOnly
=
true
;
HashMap
<
String
,
Object
>
config
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
config
=
new
HashMap
<>
();
config
.
put
(
"id"
,
id
);
config
.
put
(
"createVersion"
,
createVersion
);
m
.
init
(
store
,
config
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
4ffb177a
...
...
@@ -205,7 +205,7 @@ public final class MVStore {
private
final
ConcurrentHashMap
<
Integer
,
MVMap
<?,
?>>
maps
=
new
ConcurrentHashMap
<>();
private
final
HashMap
<
String
,
Object
>
storeHeader
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Object
>
storeHeader
=
new
HashMap
<>
();
private
WriteBuffer
writeBuffer
;
...
...
@@ -337,7 +337,7 @@ public final class MVStore {
(
UncaughtExceptionHandler
)
config
.
get
(
"backgroundExceptionHandler"
);
meta
=
new
MVMap
<>(
StringDataType
.
INSTANCE
,
StringDataType
.
INSTANCE
);
HashMap
<
String
,
Object
>
c
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
c
=
new
HashMap
<>
();
c
.
put
(
"id"
,
0
);
c
.
put
(
"createVersion"
,
currentVersion
);
meta
.
init
(
this
,
c
);
...
...
@@ -397,7 +397,7 @@ public final class MVStore {
* @return the store
*/
public
static
MVStore
open
(
String
fileName
)
{
HashMap
<
String
,
Object
>
config
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
config
=
new
HashMap
<>
();
config
.
put
(
"fileName"
,
fileName
);
return
new
MVStore
(
config
);
}
...
...
@@ -468,7 +468,7 @@ public final class MVStore {
map
.
init
(
this
,
c
);
root
=
getRootPos
(
meta
,
id
);
}
else
{
c
=
New
.
hashMap
();
c
=
new
HashMap
<>
();
id
=
++
lastMapId
;
c
.
put
(
"id"
,
id
);
c
.
put
(
"createVersion"
,
currentVersion
);
...
...
@@ -491,7 +491,7 @@ public final class MVStore {
* @return the set of names
*/
public
synchronized
Set
<
String
>
getMapNames
()
{
HashSet
<
String
>
set
=
New
.
hashSet
();
HashSet
<
String
>
set
=
new
HashSet
<>
();
checkOpen
();
for
(
Iterator
<
String
>
it
=
meta
.
keyIterator
(
"name."
);
it
.
hasNext
();)
{
String
x
=
it
.
next
();
...
...
@@ -891,7 +891,7 @@ public final class MVStore {
if
(
cacheChunkRef
!=
null
)
{
cacheChunkRef
.
clear
();
}
for
(
MVMap
<?,
?>
m
:
New
.
arrayList
(
maps
.
values
()))
{
for
(
MVMap
<?,
?>
m
:
new
ArrayList
<>
(
maps
.
values
()))
{
m
.
close
();
}
chunks
.
clear
();
...
...
@@ -1090,7 +1090,7 @@ public final class MVStore {
// force a metadata update
meta
.
put
(
Chunk
.
getMetaKey
(
c
.
id
),
c
.
asString
());
meta
.
remove
(
Chunk
.
getMetaKey
(
c
.
id
));
ArrayList
<
MVMap
<?,
?>>
list
=
New
.
arrayList
(
maps
.
values
());
ArrayList
<
MVMap
<?,
?>>
list
=
new
ArrayList
<>
(
maps
.
values
());
ArrayList
<
MVMap
<?,
?>>
changed
=
New
.
arrayList
();
for
(
MVMap
<?,
?>
m
:
list
)
{
m
.
setWriteVersion
(
version
);
...
...
@@ -1277,7 +1277,7 @@ public final class MVStore {
long
testVersion
=
lastChunk
.
version
;
DataUtils
.
checkArgument
(
testVersion
>
0
,
"Collect references on version 0"
);
long
readCount
=
getFileStore
().
readCount
.
get
();
Set
<
Integer
>
referenced
=
New
.
hashSet
();
Set
<
Integer
>
referenced
=
new
HashSet
<>
();
for
(
Cursor
<
String
,
String
>
c
=
meta
.
cursor
(
"root."
);
c
.
hasNext
();)
{
String
key
=
c
.
next
();
if
(!
key
.
startsWith
(
"root."
))
{
...
...
@@ -1305,7 +1305,7 @@ public final class MVStore {
}
PageChildren
refs
=
readPageChunkReferences
(
mapId
,
pos
,
-
1
);
if
(!
refs
.
chunkList
)
{
Set
<
Integer
>
target
=
New
.
hashSet
();
Set
<
Integer
>
target
=
new
HashSet
<>
();
for
(
int
i
=
0
;
i
<
refs
.
children
.
length
;
i
++)
{
long
p
=
refs
.
children
[
i
];
collectReferencedChunks
(
target
,
mapId
,
p
,
level
+
1
);
...
...
@@ -1887,7 +1887,7 @@ public final class MVStore {
}
private
void
compactRewrite
(
ArrayList
<
Chunk
>
old
)
{
HashSet
<
Integer
>
set
=
New
.
hashSet
();
HashSet
<
Integer
>
set
=
new
HashSet
<>
();
for
(
Chunk
c
:
old
)
{
set
.
add
(
c
.
id
);
}
...
...
@@ -2316,7 +2316,7 @@ public final class MVStore {
writeStoreHeader
();
readStoreHeader
();
}
for
(
MVMap
<?,
?>
m
:
New
.
arrayList
(
maps
.
values
()))
{
for
(
MVMap
<?,
?>
m
:
new
ArrayList
<>
(
maps
.
values
()))
{
int
id
=
m
.
getId
();
if
(
m
.
getCreateVersion
()
>=
version
)
{
m
.
close
();
...
...
@@ -2720,7 +2720,7 @@ public final class MVStore {
* Creates new instance of MVStore.Builder.
*/
public
Builder
()
{
config
=
New
.
hashMap
();
config
=
new
HashMap
<>
();
}
private
Builder
set
(
String
key
,
Object
value
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
4ffb177a
...
...
@@ -1102,7 +1102,7 @@ public class Page {
* indirectly point to other chunks).
*/
void
removeDuplicateChunkReferences
()
{
HashSet
<
Integer
>
chunks
=
New
.
hashSet
();
HashSet
<
Integer
>
chunks
=
new
HashSet
<>
();
// we don't need references to leaves in the same chunk
chunks
.
add
(
DataUtils
.
getPageChunkId
(
pos
));
for
(
int
i
=
0
;
i
<
children
.
length
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
4ffb177a
...
...
@@ -120,7 +120,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
@Override
public
void
addBufferedRows
(
List
<
String
>
bufferNames
)
{
ArrayList
<
String
>
mapNames
=
New
.
arrayList
(
bufferNames
);
ArrayList
<
String
>
mapNames
=
new
ArrayList
<>
(
bufferNames
);
CompareMode
compareMode
=
database
.
getCompareMode
();
int
buffersCount
=
bufferNames
.
size
();
Queue
<
Source
>
queue
=
new
PriorityQueue
<>(
buffersCount
,
new
Source
.
Comparator
(
compareMode
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
4ffb177a
...
...
@@ -9,6 +9,7 @@ import java.util.ArrayDeque;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -368,7 +369,7 @@ public class MVTable extends TableBase {
if
(
clash
==
null
)
{
// verification is started
clash
=
session
;
visited
=
New
.
hashSet
();
visited
=
new
HashSet
<>
();
}
else
if
(
clash
==
session
)
{
// we found a circle where this session is involved
return
New
.
arrayList
();
...
...
@@ -590,7 +591,7 @@ public class MVTable extends TableBase {
Store
store
=
session
.
getDatabase
().
getMvStore
();
int
bufferSize
=
database
.
getMaxMemoryRows
()
/
2
;
ArrayList
<
Row
>
buffer
=
New
.
arrayList
(
bufferSize
);
ArrayList
<
Row
>
buffer
=
new
ArrayList
<>
(
bufferSize
);
String
n
=
getName
()
+
":"
+
index
.
getName
();
int
t
=
MathUtils
.
convertLongToInt
(
total
);
ArrayList
<
String
>
bufferNames
=
New
.
arrayList
();
...
...
@@ -631,7 +632,7 @@ public class MVTable extends TableBase {
Cursor
cursor
=
scan
.
find
(
session
,
null
,
null
);
long
i
=
0
;
int
bufferSize
=
(
int
)
Math
.
min
(
total
,
database
.
getMaxMemoryRows
());
ArrayList
<
Row
>
buffer
=
New
.
arrayList
(
bufferSize
);
ArrayList
<
Row
>
buffer
=
new
ArrayList
<>
(
bufferSize
);
String
n
=
getName
()
+
":"
+
index
.
getName
();
int
t
=
MathUtils
.
convertLongToInt
(
total
);
while
(
cursor
.
next
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
4ffb177a
...
...
@@ -412,7 +412,7 @@ public class MVTableEngine implements TableEngine {
* @return the statistics
*/
public
Map
<
String
,
Integer
>
statisticsEnd
()
{
HashMap
<
String
,
Integer
>
map
=
New
.
hashMap
();
HashMap
<
String
,
Integer
>
map
=
new
HashMap
<>
();
FileStore
fs
=
store
.
getFileStore
();
int
reads
=
fs
==
null
?
0
:
(
int
)
(
fs
.
getReadCount
()
-
statisticsStart
);
map
.
put
(
"reads"
,
reads
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
4ffb177a
...
...
@@ -60,7 +60,7 @@ public class TransactionStore {
* The map of maps.
*/
private
final
HashMap
<
Integer
,
MVMap
<
Object
,
VersionedValue
>>
maps
=
New
.
hashMap
();
new
HashMap
<>
();
private
final
DataType
dataType
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/LocalResult.java
浏览文件 @
4ffb177a
...
...
@@ -408,7 +408,7 @@ public class LocalResult implements ResultInterface, ResultTarget {
}
if
(
external
==
null
)
{
if
(
rows
.
size
()
>
limit
)
{
rows
=
New
.
arrayList
(
rows
.
subList
(
0
,
limit
));
rows
=
new
ArrayList
<>
(
rows
.
subList
(
0
,
limit
));
rowCount
=
limit
;
distinctRows
=
null
;
}
...
...
@@ -504,7 +504,7 @@ public class LocalResult implements ResultInterface, ResultTarget {
}
else
{
// avoid copying the whole array for each row
int
remove
=
Math
.
min
(
offset
,
rows
.
size
());
rows
=
New
.
arrayList
(
rows
.
subList
(
remove
,
rows
.
size
()));
rows
=
new
ArrayList
<>
(
rows
.
subList
(
remove
,
rows
.
size
()));
rowCount
-=
remove
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
4ffb177a
...
...
@@ -56,7 +56,7 @@ public class Schema extends DbObjectBase {
* avoid returning the same unique name twice when multiple threads
* concurrently create objects.
*/
private
final
HashSet
<
String
>
temporaryUniqueNames
=
New
.
hashSet
();
private
final
HashSet
<
String
>
temporaryUniqueNames
=
new
HashSet
<>
();
/**
* Create a new schema object.
...
...
@@ -133,7 +133,7 @@ public class Schema extends DbObjectBase {
runLoopAgain
=
false
;
if
(
tablesAndViews
!=
null
)
{
// Loop over a copy because the map is modified underneath us.
for
(
Table
obj
:
New
.
arrayList
(
tablesAndViews
.
values
()))
{
for
(
Table
obj
:
new
ArrayList
<>
(
tablesAndViews
.
values
()))
{
// Check for null because multiple tables might be deleted
// in one go underneath us.
if
(
obj
.
getName
()
!=
null
)
{
...
...
@@ -584,7 +584,7 @@ public class Schema extends DbObjectBase {
*/
public
ArrayList
<
SchemaObject
>
getAll
(
int
type
)
{
Map
<
String
,
SchemaObject
>
map
=
getMap
(
type
);
return
New
.
arrayList
(
map
.
values
());
return
new
ArrayList
<>
(
map
.
values
());
}
/**
...
...
@@ -594,14 +594,14 @@ public class Schema extends DbObjectBase {
*/
public
ArrayList
<
Table
>
getAllTablesAndViews
()
{
synchronized
(
database
)
{
return
New
.
arrayList
(
tablesAndViews
.
values
());
return
new
ArrayList
<>
(
tablesAndViews
.
values
());
}
}
public
ArrayList
<
TableSynonym
>
getAllSynonyms
()
{
synchronized
(
database
)
{
return
New
.
arrayList
(
synonyms
.
values
());
return
new
ArrayList
<>
(
synonyms
.
values
());
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
4ffb177a
...
...
@@ -14,6 +14,7 @@ import java.sql.DriverManager;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
...
...
@@ -306,7 +307,7 @@ public class TcpServer implements Service {
}
}
// TODO server: using a boolean 'now' argument? a timeout?
for
(
TcpServerThread
c
:
New
.
arrayList
(
running
))
{
for
(
TcpServerThread
c
:
new
ArrayList
<>
(
running
))
{
if
(
c
!=
null
)
{
c
.
close
();
try
{
...
...
@@ -483,7 +484,7 @@ public class TcpServer implements Service {
* @param statementId the statement id
*/
void
cancelStatement
(
String
sessionId
,
int
statementId
)
{
for
(
TcpServerThread
c
:
New
.
arrayList
(
running
))
{
for
(
TcpServerThread
c
:
new
ArrayList
<>
(
running
))
{
if
(
c
!=
null
)
{
c
.
cancelStatement
(
sessionId
,
statementId
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
4ffb177a
...
...
@@ -15,6 +15,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.Timestamp
;
import
java.sql.Types
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -66,7 +67,7 @@ public class PgServer implements Service {
public
static
final
int
PG_TYPE_TIMESTAMP_NO_TMZONE
=
1114
;
public
static
final
int
PG_TYPE_NUMERIC
=
1700
;
private
final
HashSet
<
Integer
>
typeSet
=
New
.
hashSet
();
private
final
HashSet
<
Integer
>
typeSet
=
new
HashSet
<>
();
private
int
port
=
PgServer
.
DEFAULT_PORT
;
private
boolean
portIsSet
;
...
...
@@ -224,7 +225,7 @@ public class PgServer implements Service {
}
}
// TODO server: using a boolean 'now' argument? a timeout?
for
(
PgServerThread
c
:
New
.
arrayList
(
running
))
{
for
(
PgServerThread
c
:
new
ArrayList
<>
(
running
))
{
c
.
close
();
try
{
Thread
t
=
c
.
getThread
();
...
...
@@ -262,7 +263,7 @@ public class PgServer implements Service {
* @return the thread
*/
PgServerThread
getThread
(
int
processId
)
{
for
(
PgServerThread
c
:
New
.
arrayList
(
running
))
{
for
(
PgServerThread
c
:
new
ArrayList
<>
(
running
))
{
if
(
c
.
getProcessId
()
==
processId
)
{
return
c
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
4ffb177a
...
...
@@ -297,7 +297,7 @@ public class WebApp {
space
=
" "
;
}
}
ArrayList
<
String
>
list
=
New
.
arrayList
(
map
.
size
());
ArrayList
<
String
>
list
=
new
ArrayList
<>
(
map
.
size
());
for
(
Map
.
Entry
<
String
,
String
>
entry
:
map
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
();
...
...
@@ -542,7 +542,7 @@ public class WebApp {
// SQLite
return
treeIndex
;
}
HashMap
<
String
,
IndexInfo
>
indexMap
=
New
.
hashMap
();
HashMap
<
String
,
IndexInfo
>
indexMap
=
new
HashMap
<>
();
while
(
rs
.
next
())
{
String
name
=
rs
.
getString
(
"INDEX_NAME"
);
IndexInfo
info
=
indexMap
.
get
(
name
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
4ffb177a
...
...
@@ -154,11 +154,11 @@ public class WebServer implements Service {
private
final
Set
<
WebThread
>
running
=
Collections
.
synchronizedSet
(
new
HashSet
<
WebThread
>());
private
boolean
ssl
;
private
final
HashMap
<
String
,
ConnectionInfo
>
connInfoMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
ConnectionInfo
>
connInfoMap
=
new
HashMap
<>
();
private
long
lastTimeoutCheck
;
private
final
HashMap
<
String
,
WebSession
>
sessions
=
New
.
hashMap
();
private
final
HashSet
<
String
>
languages
=
New
.
hashSet
();
private
final
HashMap
<
String
,
WebSession
>
sessions
=
new
HashMap
<>
();
private
final
HashSet
<
String
>
languages
=
new
HashSet
<>
();
private
String
startDateTime
;
private
ServerSocket
serverSocket
;
private
String
url
;
...
...
@@ -212,7 +212,7 @@ public class WebServer implements Service {
WebSession
getSession
(
String
sessionId
)
{
long
now
=
System
.
currentTimeMillis
();
if
(
lastTimeoutCheck
+
SESSION_TIMEOUT
<
now
)
{
for
(
String
id
:
New
.
arrayList
(
sessions
.
keySet
()))
{
for
(
String
id
:
new
ArrayList
<>
(
sessions
.
keySet
()))
{
WebSession
session
=
sessions
.
get
(
id
);
if
(
session
.
lastAccess
+
SESSION_TIMEOUT
<
now
)
{
trace
(
"timeout for "
+
id
);
...
...
@@ -396,10 +396,10 @@ public class WebServer implements Service {
}
}
// TODO server: using a boolean 'now' argument? a timeout?
for
(
WebSession
session
:
New
.
arrayList
(
sessions
.
values
()))
{
for
(
WebSession
session
:
new
ArrayList
<>
(
sessions
.
values
()))
{
session
.
close
();
}
for
(
WebThread
c
:
New
.
arrayList
(
running
))
{
for
(
WebThread
c
:
new
ArrayList
<>
(
running
))
{
try
{
c
.
stopNow
();
c
.
join
(
100
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebSession.java
浏览文件 @
4ffb177a
...
...
@@ -37,7 +37,7 @@ class WebSession {
/**
* The session attribute map.
*/
final
HashMap
<
String
,
Object
>
map
=
New
.
hashMap
();
final
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>
();
/**
* The current locale.
...
...
@@ -199,7 +199,7 @@ class WebSession {
* @return a map containing the session meta data
*/
HashMap
<
String
,
Object
>
getInfo
()
{
HashMap
<
String
,
Object
>
m
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
m
=
new
HashMap
<>
();
m
.
putAll
(
map
);
m
.
put
(
"lastAccess"
,
new
Timestamp
(
lastAccess
).
toString
());
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/LobStorageBackend.java
浏览文件 @
4ffb177a
...
...
@@ -89,7 +89,7 @@ public class LobStorageBackend implements LobStorageInterface {
JdbcConnection
conn
;
final
Database
database
;
private
final
HashMap
<
String
,
PreparedStatement
>
prepared
=
New
.
hashMap
();
private
final
HashMap
<
String
,
PreparedStatement
>
prepared
=
new
HashMap
<>
();
private
long
nextBlock
;
private
final
CompressTool
compress
=
CompressTool
.
getInstance
();
private
long
[]
hashBlocks
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageLog.java
浏览文件 @
4ffb177a
...
...
@@ -150,7 +150,7 @@ public class PageLog {
* The session state map.
* Only used during recovery.
*/
private
HashMap
<
Integer
,
SessionState
>
sessionStates
=
New
.
hashMap
();
private
HashMap
<
Integer
,
SessionState
>
sessionStates
=
new
HashMap
<>
();
/**
* The map of pages used by the transaction log.
...
...
@@ -869,7 +869,7 @@ public class PageLog {
* Called after the recovery has been completed.
*/
void
recoverEnd
()
{
sessionStates
=
New
.
hashMap
();
sessionStates
=
new
HashMap
<>
();
}
private
void
flushOut
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
4ffb177a
...
...
@@ -164,7 +164,7 @@ public class PageStore implements CacheWriter {
private
RegularTable
metaTable
;
private
PageDataIndex
metaIndex
;
private
final
IntIntHashMap
metaRootPageId
=
new
IntIntHashMap
();
private
final
HashMap
<
Integer
,
PageIndex
>
metaObjects
=
New
.
hashMap
();
private
final
HashMap
<
Integer
,
PageIndex
>
metaObjects
=
new
HashMap
<>
();
private
HashMap
<
Integer
,
PageIndex
>
tempObjects
;
/**
...
...
@@ -229,7 +229,7 @@ public class PageStore implements CacheWriter {
* Start collecting statistics.
*/
public
void
statisticsStart
()
{
statistics
=
New
.
hashMap
();
statistics
=
new
HashMap
<>
();
}
/**
...
...
@@ -1421,7 +1421,7 @@ public class PageStore implements CacheWriter {
if
(
index
.
getTable
().
isTemporary
())
{
// temporary indexes are removed after opening
if
(
tempObjects
==
null
)
{
tempObjects
=
New
.
hashMap
();
tempObjects
=
new
HashMap
<>
();
}
tempObjects
.
put
(
index
.
getId
(),
index
);
}
else
{
...
...
@@ -1530,7 +1530,7 @@ public class PageStore implements CacheWriter {
if
(
tableId
==
META_TABLE_ID
)
{
int
rootPageId
=
row
.
getValue
(
3
).
getInt
();
if
(
reservedPages
==
null
)
{
reservedPages
=
New
.
hashMap
();
reservedPages
=
new
HashMap
<>
();
}
reservedPages
.
put
(
rootPageId
,
logPos
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/RecoverTester.java
浏览文件 @
4ffb177a
...
...
@@ -41,7 +41,7 @@ public class RecoverTester implements Recorder {
private
final
long
maxFileSize
=
Utils
.
getProperty
(
"h2.recoverTestMaxFileSize"
,
Integer
.
MAX_VALUE
)
*
1024L
*
1024
;
private
int
verifyCount
;
private
final
HashSet
<
String
>
knownErrors
=
New
.
hashSet
();
private
final
HashSet
<
String
>
knownErrors
=
new
HashSet
<>
();
private
volatile
boolean
testing
;
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePath.java
浏览文件 @
4ffb177a
...
...
@@ -10,10 +10,10 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.nio.channels.FileChannel
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
/**
* A path to a file. It similar to the Java 7 <code>java.nio.file.Path</code>,
...
...
@@ -67,7 +67,7 @@ public abstract class FilePath {
private
static
void
registerDefaultProviders
()
{
if
(
providers
==
null
||
defaultProvider
==
null
)
{
Map
<
String
,
FilePath
>
map
=
Collections
.
synchronizedMap
(
New
.<
String
,
FilePath
>
hashMap
());
new
HashMap
<
String
,
FilePath
>
());
for
(
String
c
:
new
String
[]
{
"org.h2.store.fs.FilePathDisk"
,
"org.h2.store.fs.FilePathMem"
,
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileUtils.java
浏览文件 @
4ffb177a
...
...
@@ -11,6 +11,7 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.FileChannel
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.h2.util.New
;
...
...
@@ -149,7 +150,7 @@ public class FileUtils {
public
static
List
<
String
>
newDirectoryStream
(
String
path
)
{
List
<
FilePath
>
list
=
FilePath
.
get
(
path
).
newDirectoryStream
();
int
len
=
list
.
size
();
List
<
String
>
result
=
New
.
arrayList
(
len
);
List
<
String
>
result
=
new
ArrayList
<>
(
len
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
result
.
add
(
list
.
get
(
i
).
toString
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Plan.java
浏览文件 @
4ffb177a
...
...
@@ -23,7 +23,7 @@ import org.h2.util.New;
public
class
Plan
{
private
final
TableFilter
[]
filters
;
private
final
HashMap
<
TableFilter
,
PlanItem
>
planItems
=
New
.
hashMap
();
private
final
HashMap
<
TableFilter
,
PlanItem
>
planItems
=
new
HashMap
<>
();
private
final
Expression
[]
allConditions
;
private
final
TableFilter
[]
allFilters
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
4ffb177a
...
...
@@ -54,7 +54,7 @@ public class RegularTable extends TableBase {
private
Index
scanIndex
;
private
long
rowCount
;
private
volatile
Session
lockExclusiveSession
;
private
HashSet
<
Session
>
lockSharedSessions
=
New
.
hashSet
();
private
HashSet
<
Session
>
lockSharedSessions
=
new
HashSet
<>
();
/**
* The queue of sessions waiting to lock the table. It is a FIFO queue to
...
...
@@ -265,7 +265,7 @@ public class RegularTable extends TableBase {
Cursor
cursor
=
scan
.
find
(
session
,
null
,
null
);
long
i
=
0
;
int
bufferSize
=
(
int
)
Math
.
min
(
rowCount
,
database
.
getMaxMemoryRows
());
ArrayList
<
Row
>
buffer
=
New
.
arrayList
(
bufferSize
);
ArrayList
<
Row
>
buffer
=
new
ArrayList
<>
(
bufferSize
);
String
n
=
getName
()
+
":"
+
index
.
getName
();
int
t
=
MathUtils
.
convertLongToInt
(
total
);
while
(
cursor
.
next
())
{
...
...
@@ -612,7 +612,7 @@ public class RegularTable extends TableBase {
if
(
clash
==
null
)
{
// verification is started
clash
=
session
;
visited
=
New
.
hashSet
();
visited
=
new
HashSet
<>
();
}
else
if
(
clash
==
session
)
{
// we found a circle where this session is involved
return
New
.
arrayList
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
4ffb177a
...
...
@@ -577,7 +577,7 @@ public abstract class Table extends SchemaObjectBase {
*/
public
void
dropMultipleColumnsConstraintsAndIndexes
(
Session
session
,
ArrayList
<
Column
>
columnsToDrop
)
{
HashSet
<
Constraint
>
constraintsToDrop
=
New
.
hashSet
();
HashSet
<
Constraint
>
constraintsToDrop
=
new
HashSet
<>
();
if
(
constraints
!=
null
)
{
for
(
Column
col
:
columnsToDrop
)
{
for
(
int
i
=
0
,
size
=
constraints
.
size
();
i
<
size
;
i
++)
{
...
...
@@ -595,7 +595,7 @@ public abstract class Table extends SchemaObjectBase {
}
}
}
HashSet
<
Index
>
indexesToDrop
=
New
.
hashSet
();
HashSet
<
Index
>
indexesToDrop
=
new
HashSet
<>
();
ArrayList
<
Index
>
indexes
=
getIndexes
();
if
(
indexes
!=
null
)
{
for
(
Column
col
:
columnsToDrop
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
4ffb177a
...
...
@@ -52,7 +52,7 @@ public class TableLink extends Table {
private
final
String
originalSchema
;
private
String
driver
,
url
,
user
,
password
,
originalTable
,
qualifiedTableName
;
private
TableLinkConnection
conn
;
private
HashMap
<
String
,
PreparedStatement
>
preparedMap
=
New
.
hashMap
();
private
HashMap
<
String
,
PreparedStatement
>
preparedMap
=
new
HashMap
<>
();
private
final
ArrayList
<
Index
>
indexes
=
New
.
arrayList
();
private
final
boolean
emitUpdates
;
private
LinkedIndex
linkedIndex
;
...
...
@@ -128,7 +128,7 @@ public class TableLink extends Table {
rs
=
meta
.
getColumns
(
null
,
originalSchema
,
originalTable
,
null
);
int
i
=
0
;
ArrayList
<
Column
>
columnList
=
New
.
arrayList
();
HashMap
<
String
,
Column
>
columnMap
=
New
.
hashMap
();
HashMap
<
String
,
Column
>
columnMap
=
new
HashMap
<>
();
String
catalog
=
null
,
schema
=
null
;
while
(
rs
.
next
())
{
String
thisCatalog
=
rs
.
getString
(
"TABLE_CAT"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableView.java
浏览文件 @
4ffb177a
...
...
@@ -169,7 +169,7 @@ public class TableView extends Table {
try
{
Query
compiledQuery
=
compileViewQuery
(
session
,
querySQL
,
literalsChecked
,
getName
());
this
.
querySQL
=
compiledQuery
.
getPlanSQL
();
tables
=
New
.
arrayList
(
compiledQuery
.
getTables
());
tables
=
new
ArrayList
<>
(
compiledQuery
.
getTables
());
ArrayList
<
Expression
>
expressions
=
compiledQuery
.
getExpressions
();
ArrayList
<
Column
>
list
=
New
.
arrayList
();
ColumnNamer
columnNamer
=
new
ColumnNamer
(
session
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
4ffb177a
...
...
@@ -27,7 +27,7 @@ import org.h2.util.Tool;
*/
public
class
ConvertTraceFile
extends
Tool
{
private
final
HashMap
<
String
,
Stat
>
stats
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Stat
>
stats
=
new
HashMap
<>
();
private
long
timeTotal
;
/**
...
...
@@ -179,7 +179,7 @@ public class ConvertTraceFile extends Tool {
scriptWriter
.
println
(
"-----------------------------------------"
);
scriptWriter
.
println
(
"-- self accu time count result sql"
);
int
accumTime
=
0
;
ArrayList
<
Stat
>
list
=
New
.
arrayList
(
stats
.
values
());
ArrayList
<
Stat
>
list
=
new
ArrayList
<>
(
stats
.
values
());
Collections
.
sort
(
list
);
if
(
timeTotal
==
0
)
{
timeTotal
=
1
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
4ffb177a
...
...
@@ -553,7 +553,7 @@ public class Recover extends Tool implements DataHandler {
dumpPageStore
(
devNull
,
pageCount
);
stat
=
new
Stats
();
schema
.
clear
();
objectIdSet
=
New
.
hashSet
();
objectIdSet
=
new
HashSet
<>
();
dumpPageStore
(
writer
,
pageCount
);
writeSchema
(
writer
);
try
{
...
...
@@ -1515,9 +1515,9 @@ public class Recover extends Tool implements DataHandler {
private
void
resetSchema
()
{
schema
=
New
.
arrayList
();
objectIdSet
=
New
.
hashSet
();
tableMap
=
New
.
hashMap
();
columnTypeMap
=
New
.
hashMap
();
objectIdSet
=
new
HashSet
<>
();
tableMap
=
new
HashMap
<>
();
columnTypeMap
=
new
HashMap
<>
();
}
private
void
writeSchema
(
PrintWriter
writer
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
4ffb177a
...
...
@@ -146,7 +146,7 @@ public class JdbcUtils {
String
s
=
SysProperties
.
ALLOWED_CLASSES
;
ArrayList
<
String
>
prefixes
=
New
.
arrayList
();
boolean
allowAll
=
false
;
HashSet
<
String
>
classNames
=
New
.
hashSet
();
HashSet
<
String
>
classNames
=
new
HashSet
<>
();
for
(
String
p
:
StringUtils
.
arraySplit
(
s
,
','
,
true
))
{
if
(
p
.
equals
(
"*"
))
{
allowAll
=
true
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/New.java
浏览文件 @
4ffb177a
...
...
@@ -6,9 +6,6 @@
package
org
.
h2
.
util
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashSet
;
/**
* This class contains static methods to construct commonly used generic objects
...
...
@@ -26,59 +23,4 @@ public class New {
return
new
ArrayList
<>(
4
);
}
/**
* Create a new HashMap.
*
* @param <K> the key type
* @param <V> the value type
* @return the object
*/
public
static
<
K
,
V
>
HashMap
<
K
,
V
>
hashMap
()
{
return
new
HashMap
<>();
}
/**
* Create a new HashMap.
*
* @param <K> the key type
* @param <V> the value type
* @param initialCapacity the initial capacity
* @return the object
*/
public
static
<
K
,
V
>
HashMap
<
K
,
V
>
hashMap
(
int
initialCapacity
)
{
return
new
HashMap
<>(
initialCapacity
);
}
/**
* Create a new HashSet.
*
* @param <T> the type
* @return the object
*/
public
static
<
T
>
HashSet
<
T
>
hashSet
()
{
return
new
HashSet
<>();
}
/**
* Create a new ArrayList.
*
* @param <T> the type
* @param c the collection
* @return the object
*/
public
static
<
T
>
ArrayList
<
T
>
arrayList
(
Collection
<
T
>
c
)
{
return
new
ArrayList
<>(
c
);
}
/**
* Create a new ArrayList.
*
* @param <T> the type
* @param initialCapacity the initial capacity
* @return the object
*/
public
static
<
T
>
ArrayList
<
T
>
arrayList
(
int
initialCapacity
)
{
return
new
ArrayList
<>(
initialCapacity
);
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/SmallMap.java
浏览文件 @
4ffb177a
...
...
@@ -16,7 +16,7 @@ import org.h2.message.DbException;
*/
public
class
SmallMap
{
private
final
HashMap
<
Integer
,
Object
>
map
=
New
.
hashMap
();
private
final
HashMap
<
Integer
,
Object
>
map
=
new
HashMap
<>
();
private
Object
cache
;
private
int
cacheId
;
private
int
lastId
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/SoftHashMap.java
浏览文件 @
4ffb177a
...
...
@@ -9,6 +9,7 @@ import java.lang.ref.Reference;
import
java.lang.ref.ReferenceQueue
;
import
java.lang.ref.SoftReference
;
import
java.util.AbstractMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -26,7 +27,7 @@ public class SoftHashMap<K, V> extends AbstractMap<K, V> {
private
final
ReferenceQueue
<
V
>
queue
=
new
ReferenceQueue
<>();
public
SoftHashMap
()
{
map
=
New
.
hashMap
();
map
=
new
HashMap
<>
();
}
@SuppressWarnings
(
"unchecked"
)
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
4ffb177a
...
...
@@ -65,17 +65,17 @@ public class SourceCompiler {
/**
* The class name to source code map.
*/
final
HashMap
<
String
,
String
>
sources
=
New
.
hashMap
();
final
HashMap
<
String
,
String
>
sources
=
new
HashMap
<>
();
/**
* The class name to byte code map.
*/
final
HashMap
<
String
,
Class
<?>>
compiled
=
New
.
hashMap
();
final
HashMap
<
String
,
Class
<?>>
compiled
=
new
HashMap
<>
();
/**
* The class name to compiled scripts map.
*/
final
Map
<
String
,
CompiledScript
>
compiledScripts
=
New
.
hashMap
();
final
Map
<
String
,
CompiledScript
>
compiledScripts
=
new
HashMap
<>
();
/**
* Whether to use the ToolProvider.getSystemJavaCompiler().
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/TempFileDeleter.java
浏览文件 @
4ffb177a
...
...
@@ -8,6 +8,7 @@ package org.h2.util;
import
java.lang.ref.PhantomReference
;
import
java.lang.ref.Reference
;
import
java.lang.ref.ReferenceQueue
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
org.h2.engine.SysProperties
;
...
...
@@ -20,7 +21,7 @@ import org.h2.store.fs.FileUtils;
public
class
TempFileDeleter
{
private
final
ReferenceQueue
<
Object
>
queue
=
new
ReferenceQueue
<>();
private
final
HashMap
<
PhantomReference
<?>,
String
>
refMap
=
New
.
hashMap
();
private
final
HashMap
<
PhantomReference
<?>,
String
>
refMap
=
new
HashMap
<>
();
private
TempFileDeleter
()
{
// utility class
...
...
@@ -78,7 +79,7 @@ public class TempFileDeleter {
* Delete all registered temp files.
*/
public
void
deleteAll
()
{
for
(
String
tempFile
:
New
.
arrayList
(
refMap
.
values
()))
{
for
(
String
tempFile
:
new
ArrayList
<>
(
refMap
.
values
()))
{
deleteFile
(
null
,
tempFile
);
}
deleteUnused
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
浏览文件 @
4ffb177a
...
...
@@ -97,9 +97,9 @@ public class ThreadDeadlockDetector {
tableSharedLocksMap
=
MVTable
.
SHARED_LOCKS
.
getSnapshotOfAllThreads
();
}
else
{
tableWaitingForLockMap
=
New
.
hashMap
();
tableExclusiveLocksMap
=
New
.
hashMap
();
tableSharedLocksMap
=
New
.
hashMap
();
tableWaitingForLockMap
=
new
HashMap
<>
();
tableExclusiveLocksMap
=
new
HashMap
<>
();
tableSharedLocksMap
=
new
HashMap
<>
();
}
final
ThreadInfo
[]
infos
=
threadBean
.
getThreadInfo
(
threadIds
,
true
,
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/Utils.java
浏览文件 @
4ffb177a
...
...
@@ -46,7 +46,7 @@ public class Utils {
private
static
final
int
MAX_GC
=
8
;
private
static
long
lastGC
;
private
static
final
HashMap
<
String
,
byte
[]>
RESOURCES
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
byte
[]>
RESOURCES
=
new
HashMap
<>
();
private
Utils
()
{
// utility class
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/ValueHashMap.java
浏览文件 @
4ffb177a
...
...
@@ -161,7 +161,7 @@ public class ValueHashMap<V> extends HashBase {
* @return all keys
*/
public
ArrayList
<
Value
>
keys
()
{
ArrayList
<
Value
>
list
=
New
.
arrayList
(
size
);
ArrayList
<
Value
>
list
=
new
ArrayList
<>
(
size
);
for
(
Value
k
:
keys
)
{
if
(
k
!=
null
&&
k
!=
ValueNull
.
DELETED
)
{
list
.
add
(
k
);
...
...
@@ -176,7 +176,7 @@ public class ValueHashMap<V> extends HashBase {
* @return all values
*/
public
ArrayList
<
V
>
values
()
{
ArrayList
<
V
>
list
=
New
.
arrayList
(
size
);
ArrayList
<
V
>
list
=
new
ArrayList
<>
(
size
);
int
len
=
keys
.
length
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
Value
k
=
keys
[
i
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/DataType.java
浏览文件 @
4ffb177a
...
...
@@ -66,8 +66,8 @@ public class DataType {
* when clearing references.
*/
private
static
final
ArrayList
<
DataType
>
TYPES
=
New
.
arrayList
();
private
static
final
HashMap
<
String
,
DataType
>
TYPES_BY_NAME
=
New
.
hashMap
();
private
static
final
HashMap
<
Integer
,
DataType
>
TYPES_BY_VALUE_TYPE
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
DataType
>
TYPES_BY_NAME
=
new
HashMap
<>
();
private
static
final
HashMap
<
Integer
,
DataType
>
TYPES_BY_VALUE_TYPE
=
new
HashMap
<>
();
/**
* The value type of this data type.
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
4ffb177a
...
...
@@ -941,7 +941,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals
(
0
,
((
Object
[])
a
.
getArray
(
2
,
0
)).
length
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
0
,
0
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
3
,
0
);
HashMap
<
String
,
Class
<?>>
map
=
New
.
hashMap
();
HashMap
<
String
,
Class
<?>>
map
=
new
HashMap
<>
();
assertEquals
(
0
,
((
Object
[])
a
.
getArray
(
1
,
0
,
map
)).
length
);
assertEquals
(
2
,
((
Object
[])
a
.
getArray
(
map
)).
length
);
assertEquals
(
2
,
((
Object
[])
a
.
getArray
(
null
)).
length
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
4ffb177a
...
...
@@ -198,7 +198,7 @@ public class TestIndex extends TestBase {
"delete from test where id=?"
);
PreparedStatement
prepSelect
=
conn
.
prepareStatement
(
"select count(*) from test where id=?"
);
HashMap
<
Long
,
Integer
>
map
=
New
.
hashMap
();
HashMap
<
Long
,
Integer
>
map
=
new
HashMap
<>
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
long
key
=
rand
.
nextInt
(
10
)
*
1000000000L
;
Integer
r
=
map
.
get
(
key
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
4ffb177a
...
...
@@ -857,7 +857,7 @@ public class TestOptimizations extends TestBase {
" table test(id int primary key, value int)"
);
stat
.
execute
(
"create index idx_value_id on test(value, id);"
);
int
len
=
getSize
(
1000
,
10000
);
HashMap
<
Integer
,
Integer
>
map
=
New
.
hashMap
();
HashMap
<
Integer
,
Integer
>
map
=
new
HashMap
<>
();
TreeSet
<
Integer
>
set
=
new
TreeSet
<>();
Random
random
=
new
Random
(
1
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
...
...
@@ -902,7 +902,7 @@ public class TestOptimizations extends TestBase {
break
;
}
case
9
:
{
ArrayList
<
Integer
>
list
=
New
.
arrayList
(
map
.
values
());
ArrayList
<
Integer
>
list
=
new
ArrayList
<>
(
map
.
values
());
int
count
=
list
.
size
();
Integer
min
=
null
,
max
=
null
;
if
(
count
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
4ffb177a
...
...
@@ -674,7 +674,7 @@ public class TestTableEngines extends TestBase {
}
private
void
doTestBatchedJoin
(
Statement
stat
,
int
...
batchSizes
)
throws
SQLException
{
ArrayList
<
TreeSetTable
>
tables
=
New
.
arrayList
(
batchSizes
.
length
);
ArrayList
<
TreeSetTable
>
tables
=
new
ArrayList
<>
(
batchSizes
.
length
);
for
(
int
i
=
0
;
i
<
batchSizes
.
length
;
i
++)
{
stat
.
executeUpdate
(
"DROP TABLE IF EXISTS T"
+
i
);
...
...
@@ -870,7 +870,7 @@ public class TestTableEngines extends TestBase {
int
cols
=
rs
.
getMetaData
().
getColumnCount
();
List
<
List
<
Object
>>
list
=
New
.
arrayList
();
while
(
rs
.
next
())
{
List
<
Object
>
row
=
New
.
arrayList
(
cols
);
List
<
Object
>
row
=
new
ArrayList
<>
(
cols
);
for
(
int
i
=
1
;
i
<=
cols
;
i
++)
{
row
.
add
(
rs
.
getObject
(
i
));
}
...
...
@@ -1406,7 +1406,7 @@ public class TestTableEngines extends TestBase {
public
Index
addIndex
(
Session
session
,
String
indexName
,
int
indexId
,
IndexColumn
[]
cols
,
IndexType
indexType
,
boolean
create
,
String
indexComment
)
{
if
(
indexes
==
null
)
{
indexes
=
New
.
arrayList
(
2
);
indexes
=
new
ArrayList
<>
(
2
);
// Scan must be always at 0.
indexes
.
add
(
scan
);
}
...
...
@@ -1573,7 +1573,7 @@ public class TestTableEngines extends TestBase {
public
List
<
Future
<
Cursor
>>
findBatched
(
final
TableFilter
filter
,
List
<
SearchRow
>
firstLastPairs
)
{
ArrayList
<
Future
<
Cursor
>>
result
=
New
.
arrayList
(
firstLastPairs
.
size
());
ArrayList
<
Future
<
Cursor
>>
result
=
new
ArrayList
<>
(
firstLastPairs
.
size
());
final
Random
rnd
=
new
Random
();
for
(
int
i
=
0
;
i
<
firstLastPairs
.
size
();
i
+=
2
)
{
final
SearchRow
first
=
firstLastPairs
.
get
(
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
4ffb177a
...
...
@@ -71,7 +71,7 @@ public class TestStatement extends TestBase {
private
void
testUnsupportedOperations
()
throws
Exception
{
conn
.
setTypeMap
(
null
);
HashMap
<
String
,
Class
<?>>
map
=
New
.
hashMap
();
HashMap
<
String
,
Class
<?>>
map
=
new
HashMap
<>
();
conn
.
setTypeMap
(
map
);
map
.
put
(
"x"
,
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
conn
).
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestCacheLIRS.java
浏览文件 @
4ffb177a
...
...
@@ -485,7 +485,7 @@ public class TestCacheLIRS extends TestBase {
Random
r
=
new
Random
(
1
);
for
(
int
j
=
0
;
j
<
100
;
j
++)
{
CacheLIRS
<
Integer
,
Integer
>
test
=
createCache
(
size
/
2
);
HashMap
<
Integer
,
Integer
>
good
=
New
.
hashMap
();
HashMap
<
Integer
,
Integer
>
good
=
new
HashMap
<>
();
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
int
key
=
r
.
nextInt
(
size
);
int
value
=
r
.
nextInt
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
浏览文件 @
4ffb177a
...
...
@@ -414,7 +414,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
Random
r
=
new
Random
(
1
);
for
(
int
j
=
0
;
j
<
100
;
j
++)
{
CacheLongKeyLIRS
<
Integer
>
test
=
createCache
(
size
/
2
);
HashMap
<
Integer
,
Integer
>
good
=
New
.
hashMap
();
HashMap
<
Integer
,
Integer
>
good
=
new
HashMap
<>
();
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
int
key
=
r
.
nextInt
(
size
);
int
value
=
r
.
nextInt
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestStreamStore.java
浏览文件 @
4ffb177a
...
...
@@ -73,7 +73,7 @@ public class TestStreamStore extends TestBase {
}
private
void
testIOException
()
throws
IOException
{
HashMap
<
Long
,
byte
[]>
map
=
New
.
hashMap
();
HashMap
<
Long
,
byte
[]>
map
=
new
HashMap
<>
();
StreamStore
s
=
new
StreamStore
(
map
);
byte
[]
id
=
s
.
put
(
new
ByteArrayInputStream
(
new
byte
[
1024
*
1024
]));
InputStream
in
=
s
.
get
(
id
);
...
...
@@ -112,7 +112,7 @@ public class TestStreamStore extends TestBase {
private
void
testExceptionDuringStore
()
throws
IOException
{
// test that if there is an IOException while storing
// the data, the entries in the map are "rolled back"
HashMap
<
Long
,
byte
[]>
map
=
New
.
hashMap
();
HashMap
<
Long
,
byte
[]>
map
=
new
HashMap
<>
();
StreamStore
s
=
new
StreamStore
(
map
);
s
.
setMaxBlockSize
(
1024
);
assertThrows
(
IOException
.
class
,
s
).
...
...
@@ -233,7 +233,7 @@ public class TestStreamStore extends TestBase {
}
private
void
testDetectIllegalId
()
throws
IOException
{
Map
<
Long
,
byte
[]>
map
=
New
.
hashMap
();
Map
<
Long
,
byte
[]>
map
=
new
HashMap
<>
();
StreamStore
store
=
new
StreamStore
(
map
);
try
{
store
.
length
(
new
byte
[]{
3
,
0
,
0
});
...
...
@@ -283,7 +283,7 @@ public class TestStreamStore extends TestBase {
}
private
void
testFormat
()
throws
IOException
{
Map
<
Long
,
byte
[]>
map
=
New
.
hashMap
();
Map
<
Long
,
byte
[]>
map
=
new
HashMap
<>
();
StreamStore
store
=
new
StreamStore
(
map
);
store
.
setMinBlockSize
(
10
);
store
.
setMaxBlockSize
(
20
);
...
...
@@ -386,7 +386,7 @@ public class TestStreamStore extends TestBase {
}
private
void
testLoop
()
throws
IOException
{
Map
<
Long
,
byte
[]>
map
=
New
.
hashMap
();
Map
<
Long
,
byte
[]>
map
=
new
HashMap
<>
();
StreamStore
store
=
new
StreamStore
(
map
);
assertEquals
(
256
*
1024
,
store
.
getMaxBlockSize
());
assertEquals
(
256
,
store
.
getMinBlockSize
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
4ffb177a
...
...
@@ -63,7 +63,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
private
final
ArrayList
<
Object
>
objects
=
New
.
arrayList
();
private
final
HashMap
<
Class
<?>,
ArrayList
<
Method
>>
classMethods
=
New
.
hashMap
();
new
HashMap
<>
();
private
RandomGen
random
=
new
RandomGen
();
private
final
ArrayList
<
String
>
statements
=
New
.
arrayList
();
private
int
openCount
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/sql/Command.java
浏览文件 @
4ffb177a
...
...
@@ -53,7 +53,7 @@ class Command {
this
.
config
=
config
;
this
.
type
=
type
;
this
.
table
=
table
;
this
.
tables
=
New
.
hashMap
();
this
.
tables
=
new
HashMap
<>
();
this
.
tables
.
put
(
alias
,
table
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/trace/Player.java
浏览文件 @
4ffb177a
...
...
@@ -51,7 +51,7 @@ public class Player {
private
static
final
String
[]
IMPORTED_PACKAGES
=
{
""
,
"java.lang."
,
"java.sql."
,
"javax.sql."
};
private
boolean
trace
;
private
final
HashMap
<
String
,
Object
>
objects
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Object
>
objects
=
new
HashMap
<>
();
/**
* Execute a trace file using the command line. The log file name to execute
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestJmx.java
浏览文件 @
4ffb177a
...
...
@@ -118,12 +118,12 @@ public class TestJmx extends TestBase {
assertEquals
(
2
,
info
.
getOperations
().
length
);
assertContains
(
info
.
getDescription
(),
"database"
);
attrMap
=
New
.
hashMap
();
attrMap
=
new
HashMap
<>
();
for
(
MBeanAttributeInfo
a
:
info
.
getAttributes
())
{
attrMap
.
put
(
a
.
getName
(),
a
);
}
assertContains
(
attrMap
.
get
(
"CacheSize"
).
getDescription
(),
"KB"
);
opMap
=
New
.
hashMap
();
opMap
=
new
HashMap
<>
();
for
(
MBeanOperationInfo
o
:
info
.
getOperations
())
{
opMap
.
put
(
o
.
getName
(),
o
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestReopen.java
浏览文件 @
4ffb177a
...
...
@@ -40,7 +40,7 @@ public class TestReopen extends TestBase implements Recorder {
private
final
long
maxFileSize
=
Utils
.
getProperty
(
"h2.reopenMaxFileSize"
,
Integer
.
MAX_VALUE
)
*
1024L
*
1024
;
private
int
verifyCount
;
private
final
HashSet
<
String
>
knownErrors
=
New
.
hashSet
();
private
final
HashSet
<
String
>
knownErrors
=
new
HashSet
<>
();
private
volatile
boolean
testing
;
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestServlet.java
浏览文件 @
4ffb177a
...
...
@@ -56,7 +56,7 @@ public class TestServlet extends TestBase {
static
class
TestServletContext
implements
ServletContext
{
private
final
Properties
initParams
=
new
Properties
();
private
final
HashMap
<
String
,
Object
>
attributes
=
New
.
hashMap
();
private
final
HashMap
<
String
,
Object
>
attributes
=
new
HashMap
<>
();
@Override
public
void
setAttribute
(
String
key
,
Object
value
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
4ffb177a
...
...
@@ -59,7 +59,7 @@ public class TestValueHashMap extends TestBase implements DataHandler {
private
void
testRandomized
()
{
ValueHashMap
<
Value
>
map
=
ValueHashMap
.
newInstance
();
HashMap
<
Value
,
Value
>
hash
=
New
.
hashMap
();
HashMap
<
Value
,
Value
>
hash
=
new
HashMap
<>
();
Random
random
=
new
Random
(
1
);
Comparator
<
Value
>
vc
=
new
Comparator
<
Value
>()
{
@Override
...
...
@@ -87,7 +87,7 @@ public class TestValueHashMap extends TestBase implements DataHandler {
break
;
case
3
:
{
ArrayList
<
Value
>
a1
=
map
.
keys
();
ArrayList
<
Value
>
a2
=
New
.
arrayList
(
hash
.
keySet
());
ArrayList
<
Value
>
a2
=
new
ArrayList
<>
(
hash
.
keySet
());
assertEquals
(
a1
.
size
(),
a2
.
size
());
Collections
.
sort
(
a1
,
vc
);
Collections
.
sort
(
a2
,
vc
);
...
...
@@ -98,7 +98,7 @@ public class TestValueHashMap extends TestBase implements DataHandler {
}
case
4
:
ArrayList
<
Value
>
a1
=
map
.
values
();
ArrayList
<
Value
>
a2
=
New
.
arrayList
(
hash
.
values
());
ArrayList
<
Value
>
a2
=
new
ArrayList
<>
(
hash
.
values
());
assertEquals
(
a1
.
size
(),
a2
.
size
());
Collections
.
sort
(
a1
,
vc
);
Collections
.
sort
(
a2
,
vc
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/utils/ProxyCodeGenerator.java
浏览文件 @
4ffb177a
...
...
@@ -23,7 +23,7 @@ import org.h2.util.SourceCompiler;
public
class
ProxyCodeGenerator
{
private
static
SourceCompiler
compiler
=
new
SourceCompiler
();
private
static
HashMap
<
Class
<?>,
Class
<?>>
proxyMap
=
New
.
hashMap
();
private
static
HashMap
<
Class
<?>,
Class
<?>>
proxyMap
=
new
HashMap
<>
();
private
final
TreeSet
<
String
>
imports
=
new
TreeSet
<>();
private
final
TreeMap
<
String
,
Method
>
methods
=
new
TreeMap
<>();
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/i18n/PrepareTranslation.java
浏览文件 @
4ffb177a
...
...
@@ -129,7 +129,7 @@ public class PrepareTranslation {
name
=
name
.
substring
(
0
,
name
.
length
()
-
4
);
String
template
=
IOUtils
.
readStringAndClose
(
new
FileReader
(
templateDir
+
"/"
+
name
+
".jsp"
),
-
1
);
HashMap
<
String
,
Object
>
map
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>
();
for
(
Object
k
:
prop
.
keySet
())
{
map
.
put
(
k
.
toString
(),
prop
.
get
(
k
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/util/FileContentHash.java
浏览文件 @
4ffb177a
...
...
@@ -32,7 +32,7 @@ public class FileContentHash {
private
static
final
boolean
WRITE_HASH_INDEX
=
true
;
private
static
final
String
HASH_INDEX
=
".hash.prop"
;
private
static
final
int
MIN_SIZE
=
0
;
private
final
HashMap
<
String
,
String
>
hashes
=
New
.
hashMap
();
private
final
HashMap
<
String
,
String
>
hashes
=
new
HashMap
<>
();
private
long
nextLog
;
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/Db.java
浏览文件 @
4ffb177a
...
...
@@ -12,6 +12,7 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -42,7 +43,7 @@ public class Db {
.
synchronizedMap
(
new
WeakIdentityHashMap
<
Object
,
Token
>());
private
final
Connection
conn
;
private
final
Map
<
Class
<?>,
TableDefinition
<?>>
classMap
=
New
.
hashMap
();
private
final
Map
<
Class
<?>,
TableDefinition
<?>>
classMap
=
new
HashMap
<>
();
private
final
SQLDialect
dialect
;
private
DbUpgrader
dbUpgrader
=
new
DefaultDbUpgrader
();
private
final
Set
<
Class
<?>>
upgradeChecked
=
Collections
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/Query.java
浏览文件 @
4ffb177a
...
...
@@ -249,7 +249,7 @@ public class Query<T> {
}
public
<
A
>
QueryWhere
<
T
>
where
(
Filter
filter
)
{
HashMap
<
String
,
Object
>
fieldMap
=
New
.
hashMap
();
HashMap
<
String
,
Object
>
fieldMap
=
new
HashMap
<>
();
for
(
Field
f
:
filter
.
getClass
().
getDeclaredFields
())
{
f
.
setAccessible
(
true
);
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/TableDefinition.java
浏览文件 @
4ffb177a
...
...
@@ -142,7 +142,7 @@ class TableDefinition<T> {
* @param columnNames the ordered list of column names
*/
void
setPrimaryKey
(
List
<
String
>
columnNames
)
{
primaryKeyColumnNames
=
New
.
arrayList
(
columnNames
);
primaryKeyColumnNames
=
new
ArrayList
<>
(
columnNames
);
// set isPrimaryKey flag for all field definitions
for
(
FieldDefinition
fieldDefinition
:
fieldMap
.
values
())
{
fieldDefinition
.
isPrimaryKey
=
this
.
primaryKeyColumnNames
...
...
@@ -183,7 +183,7 @@ class TableDefinition<T> {
void
addIndex
(
IndexType
type
,
List
<
String
>
columnNames
)
{
IndexDefinition
index
=
new
IndexDefinition
();
index
.
indexName
=
tableName
+
"_"
+
indexes
.
size
();
index
.
columnNames
=
New
.
arrayList
(
columnNames
);
index
.
columnNames
=
new
ArrayList
<>
(
columnNames
);
index
.
type
=
type
;
indexes
.
add
(
index
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jaqu/TableInspector.java
浏览文件 @
4ffb177a
...
...
@@ -16,6 +16,8 @@ import java.text.MessageFormat;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -99,7 +101,7 @@ public class TableInspector {
// indexes
rs
=
metaData
.
getIndexInfo
(
null
,
schema
,
table
,
false
,
true
);
indexes
=
New
.
hashMap
();
indexes
=
new
HashMap
<>
();
while
(
rs
.
next
())
{
IndexInspector
info
=
new
IndexInspector
(
rs
);
if
(
info
.
type
.
equals
(
IndexType
.
UNIQUE
)
...
...
@@ -117,7 +119,7 @@ public class TableInspector {
// columns
rs
=
metaData
.
getColumns
(
null
,
schema
,
table
,
null
);
columns
=
New
.
hashMap
();
columns
=
new
HashMap
<>
();
while
(
rs
.
next
())
{
ColumnInspector
col
=
new
ColumnInspector
();
col
.
name
=
rs
.
getString
(
"COLUMN_NAME"
);
...
...
@@ -159,7 +161,7 @@ public class TableInspector {
boolean
trimStrings
)
{
// import statements
Set
<
String
>
imports
=
New
.
hashSet
();
Set
<
String
>
imports
=
new
HashSet
<>
();
imports
.
add
(
JQSchema
.
class
.
getCanonicalName
());
imports
.
add
(
JQTable
.
class
.
getCanonicalName
());
imports
.
add
(
JQIndex
.
class
.
getCanonicalName
());
...
...
@@ -167,7 +169,7 @@ public class TableInspector {
// fields
StringBuilder
fields
=
new
StringBuilder
();
List
<
ColumnInspector
>
sortedColumns
=
New
.
arrayList
(
columns
.
values
());
List
<
ColumnInspector
>
sortedColumns
=
new
ArrayList
<>
(
columns
.
values
());
Collections
.
sort
(
sortedColumns
);
for
(
ColumnInspector
col
:
sortedColumns
)
{
fields
.
append
(
generateColumn
(
imports
,
col
,
trimStrings
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/java/JavaParser.java
浏览文件 @
4ffb177a
...
...
@@ -32,8 +32,7 @@ public class JavaParser {
*/
public
static
final
boolean
REF_COUNT_STATIC
=
false
;
private
static
final
HashMap
<
String
,
ClassObj
>
BUILT_IN_CLASSES
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
ClassObj
>
BUILT_IN_CLASSES
=
new
HashMap
<>();
private
static
final
int
TOKEN_LITERAL_CHAR
=
0
;
private
static
final
int
TOKEN_LITERAL_STRING
=
1
;
...
...
@@ -42,9 +41,8 @@ public class JavaParser {
private
static
final
int
TOKEN_IDENTIFIER
=
4
;
private
static
final
int
TOKEN_OTHER
=
5
;
private
static
final
HashSet
<
String
>
RESERVED
=
New
.
hashSet
();
private
static
final
HashMap
<
String
,
String
>
JAVA_IMPORT_MAP
=
New
.
hashMap
();
private
static
final
HashSet
<
String
>
RESERVED
=
new
HashSet
<>();
private
static
final
HashMap
<
String
,
String
>
JAVA_IMPORT_MAP
=
new
HashMap
<>();
private
final
ArrayList
<
ClassObj
>
allClasses
=
New
.
arrayList
();
...
...
@@ -57,16 +55,14 @@ public class JavaParser {
private
int
nextClassId
;
private
MethodObj
method
;
private
FieldObj
thisPointer
;
private
final
HashMap
<
String
,
String
>
importMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
ClassObj
>
classes
=
New
.
hashMap
();
private
final
HashMap
<
String
,
String
>
importMap
=
new
HashMap
<>
();
private
final
HashMap
<
String
,
ClassObj
>
classes
=
new
HashMap
<>
();
private
final
LinkedHashMap
<
String
,
FieldObj
>
localVars
=
new
LinkedHashMap
<>();
private
final
HashMap
<
String
,
MethodObj
>
allMethodsMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
MethodObj
>
allMethodsMap
=
new
HashMap
<>
();
private
final
ArrayList
<
Statement
>
nativeHeaders
=
New
.
arrayList
();
private
final
HashMap
<
String
,
String
>
stringToStringConstantMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
String
>
stringConstantToStringMap
=
New
.
hashMap
();
private
final
HashMap
<
String
,
String
>
stringToStringConstantMap
=
new
HashMap
<>();
private
final
HashMap
<
String
,
String
>
stringConstantToStringMap
=
new
HashMap
<>();
public
JavaParser
()
{
addBuiltInTypes
();
...
...
@@ -318,7 +314,7 @@ public class JavaParser {
classObj
.
nativeCode
.
add
(
s
);
}
thisPointer
=
null
;
HashSet
<
String
>
annotations
=
New
.
hashSet
();
HashSet
<
String
>
annotations
=
new
HashSet
<>
();
while
(
readIf
(
"@"
))
{
String
annotation
=
readIdentifier
();
annotations
.
add
(
annotation
);
...
...
@@ -1688,8 +1684,7 @@ public class JavaParser {
}
out
.
println
(
"};"
);
}
ArrayList
<
String
>
constantNames
=
New
.
arrayList
(
stringConstantToStringMap
.
keySet
());
ArrayList
<
String
>
constantNames
=
new
ArrayList
<>(
stringConstantToStringMap
.
keySet
());
Collections
.
sort
(
constantNames
);
for
(
String
c
:
constantNames
)
{
String
s
=
stringConstantToStringMap
.
get
(
c
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论