Java List.add() UnsupportedOperationException

八年前。

Java List.add() UnsupportedOperationException

______
Not every List implementation supports the add() method.
One common example is the List returned by Arrays.asList(): it is documented not to support any structural modification (i.e. removing or adding elements) (emphasis mine):
Returns a fixed-size list backed by the specified array.
Even if that’s not the specific List you’re trying to modify, the answer still applies to other Listimplementations that are either immutable or only allow some selected changes.
You can find out about this by reading the documentation of UnsupportedOperationException and List.add(), which documents this to be an “(optional operation)”. The precise meaning of this phrase is explained at the top of the List documentation.
As a workaround you can create a copy of the list to a known-modifiable implementation like ArrayList:
seeAlso = new ArrayList<>(seeAlso);

https://stackoverflow.com/questions/5755477/java-list-add-unsupportedoperationexception

MyBatis 批量 update,字段不能为 null

MyBatis Batch Update Exception: Column cannot be null

https://stackoverflow.com/questions/32217568/mybatis-batch-update-exceptioncolumn-cannot-be-null

加一句 else

为什么加

UPDATE base\_goods\_package WHEN goodsId = #{item.goodsId} THEN #{item.packageRate} WHEN goodsId = #{item.goodsId} THEN #{item.packageName} WHEN goodsId = #{item.goodsId} THEN #{item.boxLong} WHEN goodsId = #{item.goodsId} THEN #{item.boxWidth} WHEN goodsId = #{item.goodsId} THEN #{item.boxHeight} WHEN goodsId = #{item.goodsId} THEN #{item.boxWeight} WHERE goodsId = #{item.goodsId}

我错了:
参数类型为非字符串类型的时候
上面像我这样写,假如costPrice是Integer,就完蛋了。
要么 item.costPrice.toString(),要么直接删掉写成
这样。

[ERROR] The user specified as a definer ('root'@'%') does not exist

2019-05-21 08:25:18,846 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] The user specified as a definer (‘root’@’%’) does not exist
2019-05-21 08:25:18,846 [WARN]-[WARN] Resolved exception caused by Handler execution: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query

*That error may happen when you try to run some SQL commands as a ROOT user which was imported from another MySQL database

http://bitexperts.com/Question/Detail/3288/error-the-user-specified-as-a-definer-root-does-not-exist

-- Remove current user
DROP USER ‘root’@’%’;
-- Add ROOT user again
CREATE USER ‘root’@’%’ IDENTIFIED BY ‘ROOT_PASSWORD’;
-- Add permissions
GRANT ALL PRIVILEGES ON * . * TO ‘root’@’%’;
FLUSH PRIVILEGES;

那么多中文文章没有告诉我前两行的。。

String-2 > sameStarChar 不会做

CodingBat
String-2 > sameStarChar

https://codingbat.com/prob/p194491

Returns true if for every ‘*’ (star) in the string, if there are chars both immediately before and after the star, they are the same.

如果string里面的每一个“*”,前面后面都有相同的char,就返回true?

public boolean sameStarChar(String str) {
for (int i=1;i<str.length()-1; i++){
if(str.charAt(i)==’*’ && String.valueOf(str.charAt(i-1)).equals(String.valueOf(str.charAt(i+1)))) {
return true;
}
}
return false;
}

所以这是什么意思??不懂。

Windows10 自动更新滚

https://github.com/f1tz/BlockWin10AU

*[show_more more=以下方法一点卵用没有 less=服了] *

1.先装组策略。另存为xxx.cmd文件。然后打开运行。

@echo off
pushd “%dp0”
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package
3.mum >List.txt
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3
.mum >>List.txt
for /f %%i in (‘findstr /i . List.txt 2^>nul’) do dism /online /norestart /add-package:”C:\Windows\servicing\Packages\%%i”
pause

2.打开组策略。win+r -> gpedit.msc 打开本地组策略编辑器。计算机配置 -> 管理模板 -> Windows组件 -> Windows更新。
(1)配置自动更新。启用。选项里面下拉选择2-通知下载和自动安装
(2)启用软件通知。禁用。
(3)允许自动更新立即安装。禁用。

微软我想****

https://answers.microsoft.com/zh-hans/windows/forum/windows_10-update/win10%E5%BD%BB%E5%BA%95%E5%85%B3%E9%97%AD%E6%9B%B4/cc2d2631-791b-41ed-9175-88ccbea77417

3.禁用Windows Update服务和Windows Update Medic Service服务。
(1)禁止“Windows Update”服务,并在“恢复“选项卡中设置三次失败后“无操作” 。
(2)win+r -> regedit ->
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc
ImagePath键。随便改一个路径。
FailureActions键。右键点击“修改”,修改该键的二进制数据,将“0010”、“0018”行的左起第5个数值由原来的“01”改为“00”,修改完成保存关闭。
Start键。将数值改为“4”。

复发了,干掉这个试试。
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WaaSMedicSvc
LaunchProtected

控制面板 - 计划任务。直接把这两计划删掉再试试看。

[/show_more]