所以我一直在研究一些代码,我有一个名为word的自定义类。从这里我有一个单词列表(dupeWordList),并希望从该列表中删除值为null的所有单词。请记住,值在单词类中是可变的。单词class包含以下存储的值: 频率(int) 值(字符串)
无论如何,当你调用word.getValue()时它会删除所有单词,它会返回null吗?当然有办法做到这一点。如果有什么我可以遍历整个列表并执行此过程。
代码:
@ft INT,
@page INT,
@pagesize INT,
@count INT OUTPUT
AS
BEGIN
DECLARE @offset INT
SET @offset = @page * @pagesize
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
WITH OrderedSet AS (
SELECT *, ROW_NUMBER() OVER (ORDER BY Id DESC) AS 'Index'
FROM tbl_BulkUploadFiles buf
WHERE
buf.FileType = @ft )
SELECT * FROM OrderedSet WHERE [Index] BETWEEN @offset AND (@offset + @pagesize)
SET @count = (SELECT COUNT(*) FROM OrderedSet)
END
答案 0 :(得分:4)
在java 8中你可以做到
dupeWordList.removeIf(e -> e.getValue() == null)