除了出界之外,Arraylist删除方法

时间:2015-10-28 01:45:46

标签: java arraylist

我对我的代码有疑问。当我从中删除索引后尝试获取arraylist.size()时,我一直得到IndexOutOfBoundsException。当原始大小为8,然后在我删除索引后,它应该下降到7.但是它保持为8。

感谢您的帮助。

reportPat=re.compile(
   r'(Clinical details|indication)(?:[:\s]*)?(.*)'
   r'(result|description|report)(?:[:\s]*)?(.*?)'
   r'(?:(Interpretation|conclusion)(?:[:\s]*)?(.*))?$',
   re.IGNORECASE|re.DOTALL)

2 个答案:

答案 0 :(得分:1)

应该是 j < possibleMove.size()而不是 i < possibleMove.size()

for (int j = 0; j < possibleMove.size(); j++)
            System.out.printf(" %s", possibleMove.get(j));

答案 1 :(得分:0)

<?php
NavBar::begin([
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
    'class' => 'navbar navbar-inverse navbar-fixed-top',
    'role' => 'navigation',
],
]);

$menuItems = [
    ['label' => 'Home', 'url' => ['controller url here']],
];

 echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
    'items' => $menuItems,
]);
echo "<form class='navbar-form navbar-right' role='search'>
       <div class='form-group has-feedback'>
            <input id='searchbox' type='text' placeholder='Search' class='form-control'>
            <span id='searchicon' class='fa fa-search form-control-feedback'></span>
        </div>
  </form>";
NavBar::end();
?>

你应该将'pickMove.length'改为'possibleMove.size()',pickMove.length总是8