Java

时间:2019-03-09 23:36:21

标签: java dictionary hashmap equivalent

    public Dictionary<string, SomeObject> DictionaryVar= new Dictionary<string, SomeObject>();

    foreach (SomeObject ojv in DictionaryVar.Values)
    {
        if (dt.Rows.Find(obj.FirstName()) == null)
        {
            dt.Rows.Add(new object[] { false, obj.FirstName(), "", "", 0 });
        }
    }

我已经尝试过了,但是它没有用。我试图通过检查某些字段是否存在来循环遍历某些对象来填充jtable,然后将其添加到表中。

for (SomeObject bs : DictionaryVar.values()) {
    System.out.println("not getting inside");
    for (int i = 0; i < jTable1.getRowCount(); i++) {
        if (!jTable1.getValueAt(i, 1).equals(bs.FirstName())) {
            ((DefaultTableModel) jTable1.getModel()).addRow(new Object[]{false, bs.FirstName(), "", "", 0, ""});
        } else {
        }
    }

}

1 个答案:

答案 0 :(得分:0)

def imshow(image, ax=None, title=None):
    if ax is None:
        fig, ax = plt.subplots()

    # PyTorch tensors assume the color channel is the first dimension
    # but matplotlib assumes is the third dimension
    image = image.transpose((1, 2, 0))

    # Undo preprocessing
    mean = np.array([0.485, 0.456, 0.406])
    std = np.array([0.229, 0.224, 0.225])
    image = std * image + mean

    # Image needs to be clipped between 0 and 1 or it looks like noise when displayed
    image = np.clip(image, 0, 1)

    ax.imshow(image)

    return ax